Show/Hide Toolbars

TMS Data Modeler Documentation

Navigation: Basic Operations

Creating Objects in Database Model

Scroll Prev Top Next More

Creating a new Table


1. Select Table on the Create tab on the Home ribbon or Right-click on the Project explorer and select Add table . You may also use the shortcut Ctrl+T to create a new table.


2. The Table editor will open on the Workspace. You can add or edit all table data by selecting the different internal tabs: Fields, Indexes, Check constraints, Triggers and Comments.


To create fields in a table


1. Open the desired table by selecting Tables on the Project explorer and double clicking on the table's name on the list.


2. The Tables editor opens with the Fields tab selected by default. This tab is divided into three sections: Fields list, Field properties tab and Description tab.


3. On the Fields list, click on the Add button or right-click on the list background and select Add field. You may also create a new field by using the shortcut Ctrl+F.


4. Enter the field data on the Field properties section. To get detailed information, take a look at the Fields editor topic.


To create a new relationship


1. Select Relationship on the Create tab on the Home ribbon or right-click on the Project explorer and select New relationship.


2. On the New relationship dialog, select the relationship type by clicking on one of the buttons:


Non-identifying relationship: it's the most usual type of relationship. It represents a weak connection, a relationship between parent and child table that does not involve a key field, such as the relationship between tables "Products" and "Categories", for example.


Identifying relationship: a relationship where the related fields from the child table are part of the key which identifies a unique record in this table. It indicates a strong connection, such as the relationship between tables "Order details" and "Products", for example. There are no "Order details" without a related "Product", and the "Product" is part of the key of the "Order details" table.


3. Select the Parent table and the Child table from the lists, and click Ok.


4. The Add relationship dialog will open, allowing you to specify all relationship data:


In the Relationship properties section, you may visualize or set the relationship name and its description, for future reference. A default relationship name is created automatically when adding a new relationship to the project, combining parent and child table names. The relationship name may be edited at any time.


In the Relationship keys section you may visualize or edit the relationship keys by selecting them from the available list.


Parent key: Lists all available keys (primary keys and indexes) from the parent table.

Parent table: This column shows all fields on the parent table which are part of the selected parent key. It is not possible to modify this data.

Child table: This column lists all fields on the child table that are compatible with the selected field on the parent table (same type). By default a new field listed as "field_name(new)" with the same name and type of the parent key is created and selected. It is possible to select any other available child field from the list.


In the Relationship options section, you are able to select the relationship behavior when a record on the parent table is deleted or updated:


No action: no action is taken when there are changes on the parent table. This is the default option.

Cascade: automatically deletes all records on the child table when a parent record is deleted. Example: Customer/Contact, when deleting a customer, all of its contacts are also deleted.

Set null: when a parent record is deleted, all child records related to it get this field set to null. Example: on the Person/Gender deletion, all people related to this record would be set to null.

Set default: similar to "set null" option, but instead of setting the field to null, it is filled with its default value.


5.   The created relationship will be listed under the Relationship branch of the Data dictionary tree. To edit any of the relationship data, double-click on the relationship on the Project explorer and the Relationship editor will open.


You may also create a relationship visually, by using a Diagram. It will open the same New relationship dialog to allow properties setting.