Skip to main content

Create Table Relationships

Last updated 23/10/2023

How to Create Table Relationships with Five's Table Wizard

Learn how to create relationships between tables with Five's Table Wizard. This is the second tutorial in a series of four videos.


Create a Relationship


tip
Five's Table Wizard will create your FOREIGN KEY field and index!

info
Whe you create a relationship with another table, normally you are required to add a FOREIGN KEY field and index. The FOREIGN KEY constraint is a key used to link two tables together. A FOREIGN KEY is a field in one table that refers to the PRIMARY KEY in another table. When you create a relationship with another table with Five's Table Wizard, you DO NOT need to create the FOREIGN KEY as Five does this automatically when you select a table to create the relationship with.

Prerequisite
The table you want to create the relationship with must be saved in Five to be available in the Relationship lookup list.

1. Type a name in the Name field.


Add a Table
Figure 1 - Add a table

2. Click the Add Fields button and add field/s to your table.

tip
If your table only needs FOREIGN KEY fields, you do not have to add a field here on the General page!

Add Field/s
Figure 2 - Add field/s

3. Click the Next button.


Next Button
Figure 3 - Next button

4. Click the Add Relationships button.


Add Relationships Button
Figure 4 - Add Relationships button

5. Click the lookup icon in the Table field and select a table.

6. Optional: Click the Required checkbox.


Add a relationship
Figure 5 - Add a relationship

7. Click the Save button.


Save the table
Figure 6 - Save the table

8. Click the Save button in the Table Upgrade window.


Save the table upgrade
Figure 7 - Save the table upgrade

info
When you create your forms in Five's Form Wizard, Five will automatically reference the form connected to the table that has a foreign relationship established at the table-level, and gives the field a lookup display type as shown in the image below.

Form Wizard
Figure 8 - Form Wizard

info
Now when you are in your application, you can make a selection from the lookup as shown in the image below.

Lookup
Figure 9 - Lookup