You are in: Products > HoneyMonitor > Reference Manual > On-line Consultation >



41.7 Foreign Keys

The InnoDB tables support Foreign Keys.

A Foreign Key is a referential constraint between two tables. The Foreign Key identifies a column or a set of columns in one (referencing) table that refers to a column or set of columns in another (referenced) table. Foreign Keys are used to link information together and it is an essential part of database normalization.

Creating a Foreign Key
To create a Foreign Key:
  1. open the ''Server Object List'' (chap. 16);
  2. expand the ''Tables'' node relating the database which contains the table you want to create the key in;
  3. double click on the table name;
  4. click on the ''Foreign Keys'' Tab of the ''Table Editor'' (sec. 41.4);
  5. click the ''Add Foreign Key'' button (or right click and select the ''Add Foreign Key'' item from the popup menu);
  6. use the ''Foreign Key Editor'' (sec. 41.7.1).

Editing a Foreign Key
To edit a Foreign Key:
  1. open the ''Server Object List'' (chap. 16);
  2. expand the ''Tables'' node relating the database which contains the table which contains the key you want to edit;
  3. double click on the table name;
  4. click on the ''Foreign Keys'' Tab of the ''Table Editor'' (sec. 41.4);
  5. in the keys' grid select the row relating the key you want to edit;
  6. click the ''Edit selected Foreign Key'' button (or double click or right click and select the ''Edit Foreign Key'' item from the popup menu);
  7. use the ''Foreign Key Editor'' (sec. 41.7.1).

Dropping a Foreign Key
To drop a Foreign Key:
  1. open the ''Server Object List'' (chap. 16);
  2. expand the ''Tables'' node relating the database which contains the table you want to drop the key from;
  3. double click on the table name;
  4. click on the ''Foreign Keys'' Tab of the ''Table Editor'' (sec. 41.4);
  5. in the keys' grid select the row relating the key you want to drop;
  6. click on the ''Drop selected Foreign Key'' button (or right click and select the ''Drop Foreign Key'' item from the popup menu);
  7. confirm the requested operation.

Multi-Drop of Foreign Keys
To drop a set of Foreign Keys of a Table:
  1. open the ''Server Object List'' (chap. 16);
  2. expand the table node relating the database which contains the table you want to drop the keys from;
  3. right click on the ''Foreign Keys'' node and select the ''Multi-Drop of Foreign Keys'' item from the popup menu;
  4. use the ''Multi-Drop Wizard'' (chap. 26).


41.7.1 Foreign Keys Editor

The Foreign Keys Editor allows you to create and edit foreign keys. The caption of the Editor reports if you are adding or editing a key.

The ''Editor'' (Fig. 41.53) can be opened from the Create Table Wizard, from the Table Editor, or using the popup menu of the Server Objects List (see the introduction of the sec. 41.7).

See Also:

  •  41.1.4: Create Table Wizard, Foreign Keys Step
  •  41.4.3: Table Editor, Foreign Keys Tab
  •  41.5.1: Field Editor
  •  41.6.1: Index Editor
  •  41.8.1: Trigger Editor
  •  41.9.2: Partition Editor


Figure 41.53: The Foreign Keys Editor.
http://www.honeysoftware.com/products/honeymonitor/doc/images/tablesmanagement/ENG/foreign_keys/fk_form.jpg


41.7.1.1 Parent Table

Choose a name for the key (if you leave ''Default name'' MySQLTM will assign a name for you) and select the fields of the foreign key (Fig. 41.54).

Figure 41.54: Foreign Keys: parent table fields.
http://www.honeysoftware.com/products/honeymonitor/doc/images/tablesmanagement/ENG/foreign_keys/parent.jpg


41.7.1.2 Child Table

Choose a database, a table and the fields of the ''child table'' (Fig. 41.55).

Figure 41.55: Foreign Keys: child table fields.
http://www.honeysoftware.com/products/honeymonitor/doc/images/tablesmanagement/ENG/foreign_keys/child.jpg


41.7.1.3 Action Rule

Choose the action rule to be used when updating or deleting records (Fig. 41.56).

Figure 41.56: Foreign Keys: action rule.
http://www.honeysoftware.com/products/honeymonitor/doc/images/tablesmanagement/ENG/foreign_keys/rule.jpg



Copyright © 2007 - 2009 HoneySoftware - All Rights Reserved

Submit feedback on this topic.






Lingue Disponibili:
    Inglese >>
    Italiano >>

Risorse Disponibili:
    Download >> Acquista >> HoneySoftware EULA >>
    Supporto Tecnico >>    

Ulteriori Risorse::
    Richiesta CD >>

 

Notizie Flash:




Possiamo aiutarti?


Chatta con noi!

Scarica Skype e Chatta con noi!
Marchio di Accettazione PayPal

Area Clienti:

User Id
Password
 

Awards:

HoneyMonitor Received "User Choice" Award at Free Download Manager

Twitter:


Follow HoneySoftware on Twitter!

Seguici @ Twitter!

Chi Siamo | Mappa del sito | Dati Personali | Contattaci || © 2007 - 2010 HoneySoftware - webmaster@honeysoftware.com. Best viewed with 1024*768 p.r. or higher.