Establish referential integrity between tables in the current database (selected in the Navigator’s Look In box). If no database is specified, you can establish referential integrity between tables in the current directory.

For the selected database login or directory of tables, establish the relationship between parent and child tables. From the available child fields, specify a child field related to the primary key field.

If you attempt to define referential integrity on a table that already contains data, some existing values may not match a value in the parent’s key field. When this happens, the operation fails to complete and you receive an error message.

You can establish referential integrity with a composite key. If the parent table has a composite key, add fields from the Fields list to match all of the parent’s key fields.

Dialog box options

 

Rule name

The name of the referential integrity rule between a parent and child table. The default name is a concatenation of the names of the parent and child tables.

Parent table

Choose a parent table from the list box. (All tables in the current database or directory appear in the Parent Table list.) When you choose a parent table, its key fields are displayed in the Primary Key Fields column in the References area of the dialog box.

Child table

Choose a child table from the list box. (All tables in the current database or directory appear in the Child Table list.) When you choose a child table, its fields available for referential integrity appear in the Available Child Fields column in the References area of the dialog box.

References panel

Displays the field choices available for the choices made in the Parent Table and Child Table list boxes.

Primary Key Fields Lists the key fields in the specified parent table. Select a field to create or change a referential integrity relationship.

Related Child Fields Lists the fields in the child table that are in a referential integrity relationship with the fields listed in the Primary Key Fields list.

Available Child Fields Lists the fields available for referential integrity in the child table. Select a field to create or change a referential integrity relationship.

Add Field (<) Establishes the referential integrity relationship between the selected child field and the selected parent field. Choose the child table’s field in the Available Child Fields list and click the Add Field arrow. The field name appears in the Related Child Fields area of the referential integrity diagram.

Update/delete behavior

Choose the rule to use when updating or deleting data in a parent table that has dependent rows in a child table:

Restrict You cannot change or delete a value in the parent’s key if there are rows that match the value in the child table.

Cascade Any change you make to the value in the key of the parent table is automatically made in the child table. If you delete a value in the key of the parent table, dependent rows in the child table are also deleted. Check your DBMS documentation to see if it supports cascading updates.

Relationship

Specify whether the tables are in a one-to-one or one-to-many relationship. The relationship you choose changes the available child fields.

One-to-one Defines relationship between the parent’s primary key field and the child’s primary key field or any field in the child that has a unique index.

One-to-many Defines relationship between the parent’s primary key field and an indexed field that is not the primary key in the child.

How to get there: Choose File|Database Administration and in the Database Administration dialog box click Referential Integrity. In the Referential Integrity Rules dialog box, click New.