Foreign Keys wizard (MySQL)

From DBArtisan
Jump to: navigation, search

Go Up to MySQL object wizards

The MySQL Foreign Keys Wizard lets you build and execute an ALTER TABLE statement with an ADD CONSTRAINT option implementing a foreign key.

The wizard makes it easy for you to create a relational link between two tables, thereby speeding queries and giving you faster access to data. By using the Create Foreign Key Wizard you obviate the need for remembering the code underlying the creation process.

To create a new foreign key using a wizard:

  1. Open a creation wizard for a foreign key. For details, see Opening an Object Wizard.
  2. Use the following topics as a guide to setting properties and performing tasks as you pass through the wizard panels:
  3. Finally, use the Execute button to create the object.

Foreign Keys - Properties

When creating or editing a foreign key, this tab/panel lets you work with the following settings:

Group Setting Description

Constraint Name

System Generated and User Specified

The constraint name must be unique. You can either rely on MySQL to assign a unique name or you can specify one.

Constraint State

On Update and On Delete

Lets you specify ON UPDATE and ON DELETE values of NO ACTION, CASCADE, RESTRICT, or SET NULL.

Foreign Keys - Column Mapping

  1. Under Referenced Table, choose the Database and then the referenced, or parent, Table.
  2. Under the Main Table, select the referencing Table.
  3. Under the Main Table, select the check box corresponding to the referring column and then under Referenced Table, select the check box corresponding to the referenced column.