Create Foreign Keys


Foreign keys can be defined to indicate a relationship between two tables. Foreign keys can be created using either of two methods.

Create a Foreign Key using a Dialog Box:

In a Database Explorer window, right click the Foreign Keys node and select Add Foreign Key from the ensuing popup menu.

Use the dialog box that appears to define the foreign key. See the links below for more information.

Click Ok to create the foreign key and add it to the database design.

Create a Quick Foreign Key:

In a diagram in the Database Explorer window, right click on the table you wish to add a foreign key to.

In the popup menu, click Add Foreign Key From and then select the parent table of this foreign key.

DbWrench will automatically add the primary key column(s) from the parent table to the child table if those columns are not present in the child table.

A primary key must be defined on the parent table before using this method.


See also:

General Foreign Key Properties
Detailed Foreign Key Properties