Insert excerpt | ||||||||
---|---|---|---|---|---|---|---|---|
|
Relationships Between Tables
Tables in PhixFlow are relational, which means that information in one table can be related to information in another table. Data can then be accessed in many different views without requiring duplication. A line connects the Primary Key or Secondary Key of one table to a Foreign Key in a different table and represents a Relationship. The relationships supported in PhixFlow are:
Table of Contents maxLevel 1 exclude ^Further Reading$|^Relationships Between Tables$
One-to-Many and Many-to-One Relationships
The relationship line between a Primary Key or Secondary Key and Foreign Key represents a one-to-many relationship. In the below example, one teacher runs many courses.
A many-to-one relationship is implied when you read a relationship in the opposite direction. In the below example, many courses are run by one teacher.
Many-to-Many Relationships
Many-to-many relationship can be supported with an intermediate table.
A many-to-many relationship is created when there is an intermediate table with a Foreign Key from each of the related tables. In the example used below, many students take many courses, and so a many-to-many relationship is created using the intermediate table, Schools_Course_Attendees.
Multi-Hop Relationships
Multi-hop relationships are relationships between tables without a direct relationship. PhixFlow supports multi-hop relationships to a distance of 4 hops. In the example ERD below, the relationship distance between the Buildings and Bookings table is 2 hops, and between the Buildings and Departments table is 4 hops.
Creating Multi-Hop Views and SubViews
When a View is created on a table,
s are created automaticallyInsert excerpt _subview _subview nopanel true Expand title How do I create a View? - On your ERD, click on your table to open the Properties
- In the Views section, click the
iconInsert excerpt _add_icon _add_icon nopanel true - Give your view a name and click
Insert excerpt _save _save nopanel true - In the View Attributes section, click the
iconInsert excerpt _attributes_icon _attributes_icon nopanel true - In the Available Attributes window, drag across the required attributes into the View Attributes section of the View
- Click on the Related Tables and repeat this for all required attributes
SubViews can be seen in Attribute Source section on the View
- SubViews represent one table linked to another
- As more attributes are added to the main View, if there's already a SubView they can be added into, they will be added automatically, otherwise another SubView will be created
Modifying SubViews
Access
properties from the View properties → Attribute Source section → double-click on a SubView nameInsert excerpt _subview _subview nopanel true - SubViews can be copied by right-clicking on the SubView in the Attribute Source section and choosing
Insert excerpt _duplicate_subview _duplicate_subview nopanel true - Duplicating a SubView does not copy the attributes, just the source and target tables are copied
- A Default Filter can be applied to the SubView and will apply to all attributes on the SubView
- If required, filters specific to an individual attribute can be applied by double-clicking the attribute name
- Aggregation can also be added to attributes this way
For a multi-hop worked example, see Multi-Hop Worked Example.