Online Documentation for SQL Manager for MySQL

Creating relations


Creating material relations

 

To establish a new material relation (which is the foreign key in terms of database management):

  • press the Create Relation button on the New object toolbar;
  • click the entity where the referential constraint should be created;
  • click the referred entity;
  • specify the new foreign key properties using Foreign key Editor.

 

VDBD - Creating relations

 

 

Creating virtual relations

 

Due to the fact that only tables of InnoDB storage engine support Foreign Keys, SQL Manager for MySQL provides an ability to build virtual relations between tables of other (non-referential) storage engines (e.g. MyISAM).

Virtual relations do not exist physically, they are only stored in the diagram. They are designed for building database structure visually regardless of the storage engines used. A virtual relation can be materialized further into a Foreign Key when you change the table storage engine to InnoDB.

 

To establish a new virtual relation (which is implemented as a virtual foreign key):

  • press the Create Virtual Relation button on the New object toolbar;
  • click the entity where the virtual referential constraint should be created;
  • click the referred entity;
  • specify the new virtual foreign key properties using Foreign key Editor.

 

Hint: To create a relation, you can also use the corresponding item of the context menu.

 

 

Once the relation is created, it is displayed as a line between two entities in the diagram area. The style the line is drawn is determined by the diagram notation.

The context menu of this line allows you to edit the foreign key using Foreign key Editor, drop the foreign key from the database, or materialize the relation (if it is virtual).

 

VDBD - Creating relations - Context menu