Online Documentation for SQL Manager for InterBase/Firebird

Creating/editing foreign key


The Foreign Key section of the Constraints dialog allows you to specify FOREIGN KEY constraint definition.

 

Tables - Constraints Editor - Foreign Key

 

Name

Name of the FOREIGN KEY constraint; the constraint name must be unique within the table.

 

The Table Fields area allows you to select Foreign key field(s).

To select a field, you need to move it from the Available Fields list to the Included Fields list. Use the Move all to Selected Move to Selected Move to Available Move all to Available buttons or drag-and-drop operations to move the fields from one list to another.

 

Foreign Table

Use the drop-down list to select the foreign table.

 

The Foreign Table Fields area allows you to select the field(s) of the Foreign table.

To select a field, you need to move it from the Available Fields list to the Included Fields list. Use the Move all to Selected Move to Selected Move to Available Move all to Available buttons or drag-and-drop operations to move the fields from one list to another.

 

If the referenced column(s) are changed frequently, it may be wise to add an index to the foreign key column so that referential actions associated with the foreign key column were performed more efficiently. See Indexes for details.

 

On Delete rule / On Update rule

Set rules to change a foreign key whenever the referenced primary key changes.

  • NO ACTION

Does not change the foreign key column(s); may cause the primary key update to fail due to referential integrity checks. This is the default action.

  • CASCADE

Delete any rows referencing the deleted row, or update the value of the referencing column to the new value of the referenced column, respectively.

  • SET NULL

Set the referencing column(s) to NULL.

  • SET DEFAULT

Set the referencing column(s) to their default values in effect when the referential integrity constraint is defined. When the default for a foreign column changes after the referential integrity constraint is defined, the change does not have an effect on the default value used in the referential integrity constraint.