Three main types of databases exist--the object-oriented model, in which the database is composed of objects with given properties; the entity-relationship model, in which diagrams showing the relationships between entities comprise the database; and the relational model, a single table that separates logical, external elements from physical, internal elements and is derived from a design in one of the other models.
The relational model is the preferred model for databases for a number of reasons. Implementations of databases such as SQL are based on this method of structuring data. The simplicity of the relational model--requiring a single table--is another justification for its widespread use for databases. Additionally, of the models presented, the relational model best approximates human thought, making it a convenient method for programmers.
Database modeling is the process of structuring the database before its creation, beginning with thought on the relationships, properties, and limitations needed to be embodied by the database. This process yields a database in object-oriented or entity-relationship form. The attributes of such a system must be converted to relations--and, possibly, modified subsequently in order to provide for optimal effectiveness--prior to implementation.
In this project, a series of relational MySQL databases was created for processing by PHP functions in order to provide the content of the interface. A set of users--Mr. Latimer and Yosemite Sam--are assigned passwords. For each user, tables containing the ticker symbols of their holdings and the corresponding quantities were created.
The information for portfolio is shown in the following MySQL command and response:
mysql> select * from portfolio; +--------------+----------+ | name | password | +--------------+----------+ | Mr. Latimer | compsys | | Yosemite Sam | boots | +--------------+----------+ 2 rows in set (0.00 sec)
The information for the accounts of Mr. Latimer and Yosemite Sam, respectively, is shown below:
mysql> select * from latimer; +-------+------+ | stock | qty | +-------+------+ | MSFT | 100 | | DELL | 100 | +-------+------+ 2 rows in set (0.00 sec)
mysql> select * from sam; +-------+------+ | stock | qty | +-------+------+ | CSCO | 100 | | KO | 100 | +-------+------+ 2 rows in set (0.00 sec)