Online Documentation for SQL Manager for MySQL

Foreign Keys


A Foreign key constraint (also called a referential integrity constraint) designates a column as the Foreign key and establishes a relationship between that foreign key and a specified Primary or Unique key called the referenced key.

 

Foreign keys are available for InnoDB storage engine tables only and are supported since MySQL version 3.23.44 (3.23.50 or higher recommended). Editing and dropping foreign keys is available since MySQL version 4.0.13. To view or change the table type, use the Table Properties dialog.

 

Table Foreign keys are managed within the Foreign Keys tab of Table Editor.

 

 

Creating Foreign Keys

 

To create a new Foreign key:

  • open the table in Table Editor;
  • proceed to the Foreign Keys tab there;
  • right-click the tab area and select the New Foreign Key context menu item, or press the Ins key;
  • define the Foreign key properties using the Foreign Key Editor dialog.

 

Editing Foreign Keys

 

To view/edit an existing Foreign key:

  • open the table in Table Editor;
  • proceed to the Foreign Keys tab there;
  • right-click the Foreign key to edit and select the Edit Foreign Key <foreign_key_name> context menu item, or simply double-click the Foreign key;
  • edit the Foreign key properties using the Foreign Key Editor dialog.

 

Dropping Foreign Keys

 

To drop a Foreign key:

  • open the table in Table Editor;
  • proceed to the Foreign Keys tab there;
  • right-click the Foreign key and select the Drop Foreign Key <foreign_key_name> context menu item;
  • confirm dropping in the dialog window.