Online Documentation for SQL Manager for MySQL

Editing foreign key definition


Use the Foreign Key Editor dialog to create/edit a foreign key constraint and specify its properties.

 

Foreign key name

Enter a name for the new foreign key, or modify the name of the foreign key being edited.

 

Table name

View the name of the table for which the foreign key is created.

 

Foreign Key Editor - Editing foreign key definition

 

 

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 Selected fields list. Use the Move to Selected Move to Available buttons or drag-and-drop operations to move the fields from one list to another.

 

Foreign database / Foreign table

Use the drop-down lists to select the foreign database and 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 Selected fields list. Use the Move to Selected Move 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 might be reasonable 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 Update rule / On Delete rule

  • NO ACTION

Does not change the foreign key; may cause the primary key update/delete to fail due to referential integrity checks.

  • RESTRICT

Produce an error indicating that the deletion or update would create a foreign key constraint violation.

  • 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.