Composite Foreign Key

How To:

To create a composite Foreign Key, follow the steps below:

Step

Action

See Also

1

Locate the required Tables in a diagram

Both tables must have defined database types

Set The Database Type

2

Select an Associate connector in the Class Relationships page of the Toolbox

 

3

Click on the Table to contain the Foreign Key (source) and draw the connector to the other Table (target)

 

4

Right-click on the connector and select the Foreign Keys context menu option

The Foreign Key Constraint dialog displays

 

5

The default foreign key name is set by the Foreign Key Name Template

To change the name to something other than the default provided by the template, select the Override Template checkbox and edit the foreign key name

Define Foreign Key Name Template

6

In the Source: panel and the Target: panel, click on the names of the required columns in each panel

 

7

Click on the OK button

The Foreign Key columns are sorted according to data type to match the data types of the targeted composite Primary Key

 

8

If required, you can change the order of the key columns by clicking on the uphand and downhand buttons

 

Example:

The example below shows how a Composite Foreign Key looks in a diagram:

ForeignKey