Skip to main content

2 - Build Database Tables

Last updated 11/12/2025

When an application record is saved in Five, a MySQL database is created and Five automatically establishes the connection with the external database management system (DBMS).

This documentation will explain how to add tables to the MySQL database for the Portfolio application via Five's Table Wizard. In total, five tables will be added. The Portfolio database model below shows the relationships between the tables.

The Sector and StockExchange tables have a one-to-many relationship with the Stock table, and the Stock table has a one-to-many relationship with the StockPrice table. At this stage no relationship has been established with the Portfolio table.


Portfolio model stage one
Figure 1 - Portfolio model stage one

Add the Portfolio Table

1. Click the Manage button in the form app bar.


Manage button
Figure 2 - Manage button

2. Click Data in the menu followed by Table Wizard in the sub-menu.


Table Wizard menu item
Figure 3 - Table Wizard menu item

3. Type Portfolio in the Name field.


Add Portfolio table
Figure 4 - Add Portfolio table

tip
Five automatically creates a Primary Key field and index for your table when you create a table via our Table Wizard!

4. Click the Add Fields button and type Name in the Name field.

tip
When in the Table Wizard, Five may help you configure your fields by setting the data type and data size!

Add Name field
Figure 5 - Add Name field

5. Click the Save button in the Table Wizard app bar.


Save button
Figure 6 - Save button

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

info
Every time you save a table in Five, you will need to save the Table Upgrade window too. The Table Upgrade window enables you to insert data into your table before saving the record.

Save button
Figure 7 - Save button

info
Once you have saved a table via our Table Wizard, you will find the table record in the Tables view. To navigate to the Tables view, click Data in the menu followed by Tables in the sub-menu.

Tables menu item
Figure 8 - Tables menu item

info
Select your record in the list and use the Fields and Indices tabs to view and maintain these table properties.

Portfolio table record
Figure 9 - Portfolio table record

Add the StockExchange Table

note
If you navigated to the Tables view to see the Portfolio table record, you will need to navigate back to the Table Wizard by selecting Data in the menu followed by Table Wizard in the sub-menu.

Table Wizard menu item
Figure 10 - Table Wizard menu item

1. Type StockExchange in the Name field.


Add StockExchange table
Figure 11 - Add StockExchange table

2. Click the Add Fields button and type StockExchangeCode in the Name field.

3. Click the Cancel button in the Size field and type 20.


Add StockExchangeCode field
Figure 12 - Add StockExchangeCode field

4. Click the Add Fields button, type name in the Name field, and click the Req. checkbox.


Add Name field
Figure 13 - Add Name field

5. Click the Save button in the Table Wizard app bar and the Table Upgrade window.


Save button
Figure 14 - Save button

Add the Sector Table

1. Type Sector in the Name field.


Add Sector table
Figure 15 - Add Sector table

2. Click the Add Fields button and type Name in the Name field.


Add Name field
Figure 16 - Add Name field

3. Click the Save button in the Table Wizard app bar and the Table Upgrade window.


Save button
Figure 17 - Save button

Add the Stock Table

1. Type Stock in the Name field.


Add Stock table
Figure 18 - Add Stock table

2. Click the Add Fields button and type StockCode in the Name field.

3. Click the Cancel button in the Size field and type 20.


Add StockCode field
Figure 19 - Add StockCode field

4. Click the Add Fields button, type Name in the Name field, and click the Req. checkbox.


Add Name field
Figure 20 - Add Name field

5. Click the Next button.


Next button
Figure 21 - Next button

6. Click the Add Relationships button, select StockExchange in the Table field, and click the Required checkbox.

tip
Five automatically creates a Foreign Key field and index when you establish a relationship with another table!

Add StockExchange relationship
Figure 22 - Add StockExchange relationship

7. Click the Add Relationships button, select Sector in the Table field, and click the Required checkbox.


Add Sector relationship
Figure 23 - Add Sector relationship

8. Click the Save button in the Table Wizard app bar and the Table Upgrade window.


Save button
Figure 24 - Save button

Add the StockPrice Table

1. Type StockPrice in the Name field.


Add StockPrice table
Figure 25 - Add StockPrice table

2. Click the Add Fields button and type PriceDate in the Name field.

tip
Five sets some field definitions for you dependent on the name or data type of the field!

Add PriceDate field
Figure 26 - Add PriceDate field

3. Click the Add Fields button, type OpenPrice in the Name field, and select Float in the Data Type field.


Add OpenPrice field
Figure 27 - Add OpenPrice field

4. Click the Add Fields button, type HighPrice in the Name field, and select Float in the Data Type field.


Add HighPrice field
Figure 28 - Add HighPrice field

5. Click the Add Fields button, type LowPrice in the Name field, and select Float in the Data Type field.


Add LowPrice field
Figure 29 - Add LowPrice field

6. Click the Add Fields button, type ClosePrice in the Name field, and select Float in the Data Type field.


Add ClosePrice field
Figure 30 - Add ClosePrice field

7. Click the Add Fields button, type Volume in the Name field, and select Integer in the Data Type field.


Add Volume field
Figure 31 - Add Volume field

8. Click the Next button.


Next Button
Figure 32 - Next button

9. Click the Add Relationships button, select Stock in the Table field, and click the Required checkbox.


Add Stock relationship
Figure 33 - Add Stock relationship

10. Click the Save button in the Table Wizard app bar and the Table Upgrade window.


Save Button
Figure 34 - Save button