Procedure documentationDefining Foreign Key Dependencies Locate this document in the navigation structure

 

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.

Prerequisites

  • 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.

Procedure

  1. In the context menu of the referencing table, choose Definition.

  2. In the context menu of the editor window, choose Edit.

  3. Open the Foreign Keys tab page.

  4. 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.

    Foreign Keys

    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

    DELETE Rule (delete_rule)

  5. 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).