## Modelling

Before starting to model the database the Design Mode has to be selected. To change the current Work Mode click the Work Mode icon in the Tools Palette.

### Tables and Relations

Tables and relations are the core components of each database model. Tables consist of the tablename, the columns and indices and various table options. Relations connect different tables with each other to form one-to-one or one-to-many relations.

#### Place a new table

To place a new table onto the model select the Table Tool from the Toolbar or press [T] on the keyboard.
The mouse cursow will change to refect the currently selected tool.

Selecting the Table Tool

To place the table click left on the model. A new table will be created. It will be named [table_XX]. The table's left upper corner will be at the position the mouse was clicked.
After the table was placed the selected tool will change back to the Pointer Tool. The mouse cursor will be changed also.

#### Edit a table

To edit an existing table make shure the Pointer Tool is selected. Double click on the table with the left mouse button. The Table Editor will be showen.

Calling the table editor

##### Defining the table's name and columns

Enter the table's name (e.g. product) and press the return key. The focus will change to the first column. It will be named id+tablename by default. To accept this name press return or overwrite the column's name first.

Now the focus has changed to the second column. Again enter the columns name and repeat for all the table's columns.

Press the Esc key after the last column was named.

Columns can be reorderd by draq'n'drop. Left click on a column's name, hold the mouse button and drag onto another column. Release the mouse button and the column will be inserted before the column it was dragged on.

##### Assigning the columns' datatypes

Press the Esc key after the last column was named.

##### Assigning datatypes

All columns will be created with the default datatype (use Options > Model Options to change the default datatype).

Assigning datatypes

To change the datatype of a column goto the Datatypes Palette and drag the appropriate datatype onto the column in the Table Editor. If the assigned datatype has parametes (e.g. VARCHAR(xxx)) enter the wanted value. Press Return to apply the changes or Esc to discard. Repeat this for all table columns.

To change a datatypes parameters doubleclick on the datatype and enter the new value.

Setting datatype parameters

##### Primary key, AutoInc and Flags

The first column has automatically been defined as primary key of the table indicated by a Key Icon left to the columns name. To remove a column from the primary key click the Key Icon. To add a column to the primary key click onto the Column Icon.

Setting the AutoIncrement property

To make a column automatically incrementing after each insert click the columns row in the AI column.

Each datatype has specific flags. They can be activated and deactivated by clicking.

##### Default Values and Comments

To set the default value of a column doubleclick in the Default Value column and enter the value. Press Return to apply the changes.

Setting Default Values

To display the columns' Comments click the icon right to the Default Value column's caption. To edit a comment doubleclick in the Comments column.

Edit the columns' comments

#### Create Table Indices

Change to the Indices Tab and click the Plus Icon to add a new index. A String Input dialog will appear. Enter the index's name and press return. The new index is displayed. Now choose the type of the index.

Create a new table index

To add a column to the index start dragging the column down to the Columns Listbox and drop it. You can reorder the columns by dragging a column onto another. To delete a column press the Delete button.

Adding columns to the index

#### Make a relation

Add another table to the model using the Table Tool (e.g. productgroup) and define the table's columns. Now select the 1:n Relation Tool (Non-Identifying Relation) from the Toolbar.

Selecting the 1:n Relation Tool (Non-Identifying Relation)

Click on the first table (productgroup) then on the second table (product) to establish the relation. Note that the second table (product) now has a foreign key column identified by (FK) right to the datatype.

Tables connected by a relation.

Doubleclick on the relation to enter the relation's name. Close the Relation Editor to apply the changes to the model.

Tables connected by a relation.

Copyright 2003 fabFORCE.net. All rights reserved. |