When the Design Editor contains two or more tables that are related with each other, the relationships between these tables are shown with lines connecting the related tables. DatabaseSpy uses different colors to distinguish the individual relationships:
•Green: Self-reference, i.e. the table uses a key that is assigned to one or more of the table's own columns.
•Blue: Incoming reference, i.e. the selected table is referenced by a key used in another table.
•Orange: Outgoing reference, i.e. the table has a key defined that references one or several column(s) in another table.
Note that the color of one and the same relation line may change depending on the table that is currently selected. For example, a foreign key relationship is displayed blue if you select the referenced table, and orange if you select the referencing table. The screenshot below shows an incoming relationship for tblAnimalCategories.
The same relationship, however, viewed from the referencing tblAnimalTypes table's point of view, is depicted with an orange relation line.
The screenshot below illustrates a self relation that makes sure that the manager number ("MgrNo") of an employee's manager is contained in the list of employee numbers ("EmpNo").
DatabaseSpy provides an option that automatically adds referenced or referencing tables to the active design.
You can also define to highlight objects that form part of the currently selected relation in the Design Editor options. In this case, as depicted in the screenshot above, tables that are not part of the selected relation are grayed out. Also note that the referenced columns are printed bold in both tables so that you can view at a glance which columns are related with each other.
To display related tables in the Design Editor:
1.Right-click a table in the Design Editor and select Add Related tables from the context menu.
2.Choose one of the following options from the sub-menu:
To highlight objects of the currently selected relation:
1.Make sure that the Highlight active relations objects check box is activated in the Design Editor options.
2.Click on a connection line. The connection line is highlighted and all tables that are not part of this relation are grayed out in the Design Editor window.
See also Foreign Keys.