Online Documentation for SQL Manager for DB2

Foreign keys


A Foreign key constraint (also called a referential integrity constraint) designates a column as the Foreign key and establishes a relationship between that foreign key and a specified Primary or Unique key called the referenced key. A composite Foreign key designates a combination of columns as the foreign key.

 

Table Foreign keys are managed within the Constraints tab of Table Editor.

 

 

Creating Foreign Keys

 

To create a new Foreign key:

  • open the table in Table Editor;
  • proceed to the Constraints tab, and then to the Foreign Key tab there;
  • right-click the tab area and select the New Foreign Key context menu item;
  • define the Foreign key properties using the Foreign Key Editor dialog.

 

Viewing Foreign Keys

 

To view an existing Foreign key:

  • open the table in Table Editor;
  • proceed to the Constraints tab, and then to the Foreign Key tab there;
  • right-click the Foreign key and select the View Foreign Key context menu item, or simply double-click the Foreign key;
  • view the Foreign key properties using the Foreign Key Editor dialog.

 

Dropping Foreign Keys

 

To drop a Foreign key:

  • open the table in Table Editor;
  • proceed to the Constraints tab, and then to the Foreign Key tab there;
  • right-click the Foreign key and select the Drop Foreign Key context menu item;
  • confirm dropping in the dialog window.