You define or change a foreign key dependency between two tables. A foreign key dependency is a constraint that all the rows in both tables must fulfill.
A foreign key dependency is also referred to as a Foreign Key or referential CONSTRAINT definition.
You are logged on to the database as a database user.
You have the ALTER privilege for the table to which the column belongs.
More information: SQL Reference Manual, Privilege Specification (priv_spec)
Columns have been created for the tables already.
The database is in the ONLINE operational state.
In the context menu of the referencing table, choose Definition.
In the context menu of the editor window, choose Edit.
Open the Foreign Keys tab page.
To define a new foreign key dependency, choose Add Foreign Key in the context menu of the editor window.
To display the existing foreign key dependencies graphically, choose References in the context menu of the editor window.
To change the definition of a foreign key dependency, overwrite the relevant property in the editor window.
Property |
Description (Link to SQL Reference Manual) |
---|---|
Name |
Foreign key name |
Referencing Columns |
Referencing column Referential CONSTRAINT Definition (referential_constraint_definition) |
Reference Schema |
Schema to which the table with the column that is referenced belongs |
Reference Table |
Table to which the column that is referenced belongs |
Reference Column |
Column which is referenced |
Rule |
Rule for behavior of the table referenced if a data record is deleted in the referencing table |
In the context menu of the editor window, choose Create Table (if you are creating a new table) or Alter Table (if the table already exists).
SQL Reference Manual, Referential CONSTRAINT Definition (referential_constraint_definition)
SQL Tutorial, Foreign Key Dependencies Between Tables