Choose your database:
AnySQL
MySQL
MS SQL Server
Oracle
PostgreSQL
SQLite
Firebird
SQL Anywhere
DB2
MaxDB

Subscribe to our news
Partners
Testimonials
Rati Dzidziguri: "I'm working on development of ERP and CRM software and during the process of creation of those products I have tried lots of solutions by the only solution I would call as an user friendly professional and with many other epithets is MySQL Maestro and all Maestro toolkits".
Manu Gupta: "What I can say about it is that its simply awesome. I just used it for a day only, and explored a lot of things in it. Wow, its great. Thanks for such a nice tool. My wishes are with you".

More

Add your opinion

SQL Maestro for MySQL online help

Prev Return to chapter overview Next

Foreign Keys

A foreign key constraint specifies that the values in a column (or a group of columns) must match the values appearing in some row of another table. They are said to maintain the referential integrity between two related tables.
 

Note: To create a foreign key constraint, it is necessary to have this privilege for both the referencing and referenced tables.
 

See also: Table Editor, Index Editor.

 

You can find answers on the commonest question about working with foreign keys here:

 

 

Foreign keys are created within the Foreign Key Properties dialog window. In order to open the dialog you should either

 

open the table in Table Editor and the Foreign Keys tab there;
press the Insert key or select the Add New Foreign Key... item from the popup menu (alternatively, you may use the corresponding link of the Navigation Bar)

or

select the table in the explorer tree and use the Create New Foreign Key popup menu item

or

select the table Foreign Keys node or any foreign key within the table in the explorer tree and use the Add New Foreign Key... popup menu item.

 

 

 

Foreign Keys are edited within the Foreign Key Properties dialog window. In order to open the dialog you should either

 

open the table in Table Editor and the Foreign Keys tab there;
press the Enter key or select the Edit Foreign Key item from the popup menu (alternatively, you may use the corresponding link of the Navigation Bar)

or

select the foreign key to edit in the explorer tree and use the Edit Foreign Key popup menu item.

       

You can change the name of the foreign key using the Rename Foreign Key dialog. To open the dialog you should either

 

select the foreign key to rename in the explorer tree;
select the Rename Foreign Key item from the popup menu

or

open the table in Table Editor and the Foreign Keys tab there;
select the foreign key to rename;
select the Rename Foreign Key item from the popup menu (alternatively, you may use the corresponding link of the Navigation Bar).

 

 

 

To drop the foreign key:

 

select the foreign key to drop in the explorer tree;
select the Drop Foreign Key item from the popup menu

or

open the table in Table Editor and the Foreign Keys tab there;
press the Delete key or select the Drop Foreign Key item from the popup menu (alternatively, you may use the corresponding link of the Navigation Bar)

 

and confirm dropping in the dialog window.

 



Prev Return to chapter overview Next