Define relation between tables

Relations between tables can by dragging the field of one table, and dropping it on the corresponding field in the related table. For example, in the departments and employees tables, you would click on the foreign key column, drag it to the departments table, and drop it on top of the id_dep. See the following image for details:

 

Afterwards, the relation should look similar to the image below:

 

When the relation is created a line and an arrow will appear between the two tables. The arrow represents the direction of the JOIN SQL statement - LEFT JOIN, RIGHT JOIN, or INNER JOIN (no arrow).

There is also the possibility to create a relation between a table and a copy of itself (self-foreign key). To create a self-foreign key relationship, just right click on the table and select the Duplicate option. Once the copy is created, use the same drag and drop process between the table and it's duplicate copy. For a definition of the self-foreign key principle, check out the Glossary tab.