Defining Foreign Key Dependencies

Use

This section shows you how to define foreign key dependencies (foreign keys, referential CONSTRAINT definitions) to other database tables when you create a database table or change the table definition. Foreign key dependencies describe the dependencies between the data of two tables.

Prerequisites

You have already defined the table columns.

Procedure

1.       In the field Foreign Key Name, enter the name for the foreign key (optional).

2.       In the field Referencing Columns, choose the referencing column, and confirm with Enter.

Copy the referenced database table from the Catalog Manager into Reference by using Drag&Drop. Select the column that is referenced and confirm with Enter.

3.       In the field On Delete, select how you want the referenced table to behave if a data record in the referencing table is deleted (DELETE rule).

4.       In the Comment field, enter a comment (optional).

5.       To add a new link, choose New Foreign Key.

6.       To insert new links and at the same time copy the definition of existing links of the same table, select the required links, and choose Copy Foreign Key.

7.       To insert new links and copy the definition of existing links from existing tables, choose Import Foreign Key. A window opens, containing all links defined by the current user. Select one or more links and choose OK.

8.       To delete a link, select it and choose Remove Foreign Key.

For information on the syntax of referential CONSTRAINT definitions, see the Referential CONSTRAINT Definition section of the SQL Reference Manual.