Skip to main content

2 - Build Database Tables

Last updated 8/11/2022

All applications built with Five use a MySQL database. This documentation will explain how to create and add tables to the MySQL database for the Portfolio Base application via Five's Table Wizard. In total, five tables will be added. The Portfolio Base database model below shows the relationships between the tables.


Portfolio Base Model Stage One
Figure 1 - Portfolio Base model stage one

How to Build a Table Using Five's Table Wizard




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

Manage Button
Figure 1 - Manage button

  1. Select Tables ] in the menu ].

Tables Menu Item
Figure 2 - Tables menu item


Add the Portfolio Table

  1. Click the New Table Wizard button ] in the list app bar ].

  2. Type " Portfolio " in the Name field ].


Add the Portfolio Table
Figure 3 - Add the Portfolio table

  1. Click the Add Fields button ].

tip

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


  1. Type " Name " in the Name field ].

  2. Type " 100 " in the Size field ].


Add the Name Field
Figure 4 - Add the Name field

  1. Click the Save button ] in the Table Wizard app bar ].

Save the Portfolio Table
Figure 5 - Save the Portfolio table


Add the Exchange Table

  1. Click the New Table Wizard button ] in the list app bar ].

  2. Type " Exchange " in the Name field ].

  3. Click the Add Fields button ].

  4. Type " ExchangeCode " in the Name field ].

  5. Type " 20 " in the Size field ].


Add the Exchange Table and the ExchangeCode Field
Figure 6 - Add the Exchange table and the ExchangeCode field

  1. Click the Add Fields button ].

  2. Type " Name " in the Name field ].

  3. Click the Req. checkbox ].

  4. Type " 100 " in the Size field ].


Add the Name Field
Figure 7 - Add the Name field

  1. Click the Save button ] in the Table Wizard app bar ].

Save the Exchange Table
Figure 8 - Save the Exchange table


Add the Sector Table

  1. Click the New Table Wizard button ] in the list app bar ].

  2. Type " Sector " in the Name field ].

  3. Click the Add Fields button ].

  4. Type " Name " in the Name field ].

  5. Type " 100 " in the Size field ].


Add the Sector Table and the Name Field
Figure 9 - Add the Sector table and the Name field

  1. Click the Save button ] in the Table Wizard app bar ].

Save the Sector Table
Figure 10 - Save the Sector table


Add the Stock Table

  1. Click the New Table Wizard button ] in the list app bar ].

  2. Type " Stock " in the Name field ].

  3. Click the Add Fields button ].

  4. Type " StockCode " in the Name field ].

  5. Type " 20 " in the Size field ].


Add the Stock table and the StockCode Field
Figure 11 - Add the Stock table and the StockCode field

  1. Click the Add Fields button ].

  2. Type " Name " in the Name field ].

  3. Click the Req. checkbox ].

  4. Type " 100 " in the Size field ].


Add the Name Field
Figure 12 - Add the Name field

  1. Click the Next button ].

Next Button
Figure 13 - Next button

  1. Click the Add Relationships button ].

  2. Click the lookup icon ] in the Table field ] and select " Exchange ".

  3. Click the Required checkbox ].


Add the Exchange Relationship
Figure 14 - Add the Exchange relationship

  1. Click the Add Relationships button ].

tip

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


  1. Click the lookup icon ] in the Table field ] and select " Sector ".

  2. Click the Required checkbox ].


Add the Sector Relationship
Figure 15 - Add the Sector relationship

  1. Click the Save button ] in the Table Wizard app bar ].

Save the Stock Table
Figure 16 - Save the Stock table


Add the StockPrice Table

  1. Click the New Table Wizard button ] in the list app bar ].

  2. Type " StockPrice " in the Name field ].

  3. Click the Add Fields button ].

  4. Type " PriceDate " in the Name field ].


Add the StockPrice Table and the PriceDate Field
Figure 17 - Add the StockPrice table and the PriceDate field

  1. Click the Add Fields button ].

  2. Type " Open " in the Name field ].

  3. Click the lookup icon ] in the Data Type field ] and select " Float ".


Add the Open Field
Figure 18 - Add the Open field

  1. Click the Add Fields button ].

  2. Type " High " in the Name field ].

  3. Click the lookup icon ] in the Data Type field ] and select " Float ".


Add the High Field
Figure 19 - Add the High field

  1. Click the Add Fields button ].

  2. Type " Low " in the Name field ].

  3. Click the lookup icon ] in the Data Type field ] and select " Float ".


Add the Low Field
Figure 20 - Add the Low field

  1. Click the Add Fields button ].

  2. Type " Close " in the Name field ].

  3. Click the lookup icon ] in the Data Type field ] and select " Float ".


Add the Close Field
Figure 21 - Add the Close field

  1. Click the Add Fields button ].

  2. Type " Volume " in the Name field ].

  3. Click the lookup icon ] in the Data Type field ] and select " Integer ".


Add the Volume Field
Figure 22 - Add the Volume field

  1. Click the Next button ].

Next Button
Figure 23 - Next button

  1. Click the Add Relationships button ].

  2. Click the lookup icon ] in the Table field ] and select " Stock ".

  3. Click the Required checkbox ].


Add the Stock Relationship
Figure 24 - Add the Stock relationship

  1. Click the Save button ] in the Table Wizard app bar ].

Save the StockPrice Form
Figure 25 - Save the StockPrice form