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.
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!
Figure 2 - Add field/s
3. Click the Next button.
Figure 3 - Next button
4. Click the 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.
Figure 5 - Add a relationship
7. Click the Save button.
Figure 6 - Save the table
8. Click the Save button in the Table Upgrade window.
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.
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.
Figure 9 - Lookup