 |
Manipulating Tables
|
 |
ERD functions specific to displayed database tables are outlined
below.
|
 |
Creating a New Table |
| Note: Selection of a database connection and associated schema is
not mandatory but provides the application with a reference point in
when generating SQL scripts and selecting table column data types.
|
- Select the New Table button from the ERD toolbar
- Select the open connection to use for this table
- Select the database catalog or schema for this table
- Enter the table name
- Complete the table definition by entering the relevant column
information for the table
- Enter any table constraint definitions in the Constraints tab
(requires at least one other table within the ERD for a foreign key
constraint to that table)
- Select the Create button
|
Adding a Table from an Existing Database |
The steps below outline the process for adding a single or multiple
table(s) from an open data source to the ERD diagram.
|
- Select the Add Table button from the ERD toolbar
- Select the open connection to use for this table
- Select the database catalog or schema for this table
- Select the tables to include within the ERD using the arrow
selection buttons
- Select the Add button
|
Altering a Table |
Tables structures may be viewed in greater detail by double-clicking
the table of interest. The resulting dialog allows for the
modification of table columns and constraints. Tables may be renamed,
associated with open connections as well as columns reordered.
|
Creating a New Table Relationship |
A new table relationship creates the foreign key constraint
references between the selected entities.
|
- Select the New Table Relationship button from the ERD toolbar
- Enter a [unique] name for this constraint
- Select the referencing table and column for the new
relationship - this is the table where the foreign key constraint will
be created
- Select the referenced table and column for the new relationship -
this is the table where the foreign key is linked to
- Select the Create button
|
The new relationship will be depicted using a single line from the
referencing table to the referenced table.
|
Deleting a Table Relationship |
Removing a relationship between tables will sever the foreign key
link. This will be reflected both in the table's description dialog and
within any generated SQL.
|
- Select the two tables that contain a foreign key relationship using
the left mouse button and the Ctrl key
- Select the Delete selected table relationship button from the ERD
toolbar
- Select the constraint(s) to be deleted from the
Delete Table Relationship dialog
- Select the Delete button
|
The visible line linking the two tables should now be removed and
reflected in respective table structures.
|
Deleting Tables |
Deleting a table or tables from the ERD will remove those tables from
the ERD.
|
- Select the table to be removed using the mouse - select multiple
tables using the Ctrl key with mouse selections
- Select the Remove selected object form the ERD
|
Generating SQL Scripts |
SQL CREATE TABLE scripts may be generated using the Generate SQL
scripts from the ERD toolbar. Each generated statement bases its content
on the ERD only - no further calls to the database are made.
|
- Select the required tables from the 'Available Tables' list using
the arrow selection buttons
- Enter the path where the generated SQL script will be saved
- Select whether to include any table constraints and if these
should be generated as a part of each individual CREATE TABLE
statement or as ALTER TABLE statements at the end of the
script
- Select the Generate button
|