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.

How to Build a Table Using Five's Table Wizard
Navigate to Tables
- Click the [ Manage button ] in the [ form app bar ].

- Select [ Tables ] in the [ menu ].

Add the Portfolio Table
Click the [ New Table Wizard button ] in the [ list app bar ].
Type " Portfolio " in the [ Name field ].

- 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!
Type " Name " in the [ Name field ].
Type " 100 " in the [ Size field ].

- Click the [ Save button ] in the [ Table Wizard app bar ].

Add the Exchange Table
Click the [ New Table Wizard button ] in the [ list app bar ].
Type " Exchange " in the [ Name field ].
Click the [ Add Fields button ].
Type " ExchangeCode " in the [ Name field ].
Type " 20 " in the [ Size field ].

Click the [ Add Fields button ].
Type " Name " in the [ Name field ].
Click the [ Req. checkbox ].
Type " 100 " in the [ Size field ].

- Click the [ Save button ] in the [ Table Wizard app bar ].

Add the Sector Table
Click the [ New Table Wizard button ] in the [ list app bar ].
Type " Sector " in the [ Name field ].
Click the [ Add Fields button ].
Type " Name " in the [ Name field ].
Type " 100 " in the [ Size field ].

- Click the [ Save button ] in the [ Table Wizard app bar ].

Add the Stock Table
Click the [ New Table Wizard button ] in the [ list app bar ].
Type " Stock " in the [ Name field ].
Click the [ Add Fields button ].
Type " StockCode " in the [ Name field ].
Type " 20 " in the [ Size field ].

Click the [ Add Fields button ].
Type " Name " in the [ Name field ].
Click the [ Req. checkbox ].
Type " 100 " in the [ Size field ].

- Click the [ Next button ].

Click the [ Add Relationships button ].
Click the [ lookup icon ] in the [ Table field ] and select " Exchange ".
Click the [ Required checkbox ].

- Click the [ Add Relationships button ].
tip
Five automatically creates a Foreign Key field and index when you establish a relationship with another table!
Click the [ lookup icon ] in the [ Table field ] and select " Sector ".
Click the [ Required checkbox ].

- Click the [ Save button ] in the [ Table Wizard app bar ].

Add the StockPrice Table
Click the [ New Table Wizard button ] in the [ list app bar ].
Type " StockPrice " in the [ Name field ].
Click the [ Add Fields button ].
Type " PriceDate " in the [ Name field ].

Click the [ Add Fields button ].
Type " Open " in the [ Name field ].
Click the [ lookup icon ] in the [ Data Type field ] and select " Float ".

Click the [ Add Fields button ].
Type " High " in the [ Name field ].
Click the [ lookup icon ] in the [ Data Type field ] and select " Float ".

Click the [ Add Fields button ].
Type " Low " in the [ Name field ].
Click the [ lookup icon ] in the [ Data Type field ] and select " Float ".

Click the [ Add Fields button ].
Type " Close " in the [ Name field ].
Click the [ lookup icon ] in the [ Data Type field ] and select " Float ".

Click the [ Add Fields button ].
Type " Volume " in the [ Name field ].
Click the [ lookup icon ] in the [ Data Type field ] and select " Integer ".

- Click the [ Next button ].

Click the [ Add Relationships button ].
Click the [ lookup icon ] in the [ Table field ] and select " Stock ".
Click the [ Required checkbox ].

- Click the [ Save button ] in the [ Table Wizard app bar ].
