To create relationships on columns in a table in the current location:
- Click
SQL for DB2
on the
Tools menu;
then click
SQL Wizard.
- If the Catalog Browser window is not open, click
to open it.
- On the Catalog Browser window, ensure the
Table tab is selected.
- Click the table you want.
- Click
Alter.
- In the
Relationships group, click
Create.
- Type a name for the foreign key.
- Type the name of the parent (referenced) table for the foreign key or click
Browse to search for it.
- Select the behaviour you require in the
On Delete and
On Update groups.
- Use the arrow pushbuttons to create a list mapping columns that you want to be foreign keys to the corresponding primary key columns in the parent table.
- When you have finished, click
OK to close the Create Relationship dialog box.
You can look at the SQL statements that will be used to make your changes by clicking
SQL.
- Click
OK to close the Alter Table window.