Referential Integrity for Tables

Referential Integrity is the state in which all values of all foreign keys are valid. DB2 helps ensure referential integrity between your tables when you define referential constraints.
carcudb2
Referential Integrity
is the state in which all values of all foreign keys are valid. DB2 helps ensure referential integrity between your tables when you define referential constraints.
The following illustration shows all the table referential integrity screens and how to invoke them:
This illustration shows the flow and relationships of panels related to table referential integrity.
 
This section describes the fields on the Table Create, Table Alter, and Table Template screens that pertain to referential integrity.
  • Forgn Key
    Create or update foreign key definitions.
    • N
      Specifies that no foreign key definition exists.
    • Y
      Specifies that a foreign key has been defined. Enter Y to create a foreign key. The Table Referential Constraints screen appears.
    • U
      Specifies to update an existing foreign key definition. The Table Referential Constraints screen appears.
      If you are creating, altering, or templating an MQT, and you have specified Initially Deferred in the Data field, the Forgn Key field is unavailable. An MQT cannot be a parent or child in a referential integrity relationship. Initially Deferred is the default value (unless overridden by object definition defaults). 
  • Column CMD
    Create a primary or foreign key definition on a column by entering a referential integrity line command.
    • F
      n
      Defines a column as part of the foreign key, where 
      n
       is the number representing the position of the column within the foreign key for a composite key. The Foreign Key Detail screen appears.
    • P
      n
      Defines a column as part of the primary key, where 
      n
       is the number representing the position of the column within the primary key for a composite key. The PK column is updated to reflect the change. The order of the number is important.
  • Table Screen Main CMD
    Enter 
    UC
     or 
    UniqueConst
     to invoke the Unique Constraints Management Screen.
  • Table Screen Column Headings
    The column headings on the Table Screen are as follows:
    • PK
      Displays the column's key sequence number (if the column is defined as part of the primary key). Enter a new number to update the primary key value.
    • UK
      Displays Y if the column is defined as part of a unique constraint in the Unique Constraint Management Screen.
    • FK
      Displays Y if the column is defined as part of a foreign key.