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.

  1. Select the New Table button from the ERD toolbar
  2. Select the open connection to use for this table
  3. Select the database catalog or schema for this table
  4. Enter the table name
  5. Complete the table definition by entering the relevant column information for the table
  6. 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)
  7. 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.

  1. Select the Add Table button from the ERD toolbar
  2. Select the open connection to use for this table
  3. Select the database catalog or schema for this table
  4. Select the tables to include within the ERD using the arrow selection buttons
  5. 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.

  1. Select the New Table Relationship button from the ERD toolbar
  2. Enter a [unique] name for this constraint
  3. Select the referencing table and column for the new relationship - this is the table where the foreign key constraint will be created
  4. Select the referenced table and column for the new relationship - this is the table where the foreign key is linked to
  5. 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.

  1. Select the two tables that contain a foreign key relationship using the left mouse button and the Ctrl key
  2. Select the Delete selected table relationship button from the ERD toolbar
  3. Select the constraint(s) to be deleted from the Delete Table Relationship dialog
  4. 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.

  1. Select the table to be removed using the mouse - select multiple tables using the Ctrl key with mouse selections
  2. 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.

  1. Select the required tables from the 'Available Tables' list using the arrow selection buttons
  2. Enter the path where the generated SQL script will be saved
  3. 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
  4. Select the Generate button