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

Subscribe to our news
Partners
Testimonials
Scott McWilliams: "I would just like to thank you for making this fantastic tool available for free. I use it all the time for both my professional and personal projects".
Steve Horne: "All in all it's a great product, I used the freeware version for a while but purchased a commercial license recently as I am now using it for my work. The ability to query SharePoint lists using SQL makes my administration tasks much easier".

More

Add your opinion

AnySQL Maestro 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