Appendix C
This diagram illustrates the tables that exist within the database, and the relationships between those tables. For example, players score goals, goals are scored at fixtures, match reports are written about specific fixtures, and so on. Many tables relate to other tables in the database, but equally, there are some tables that stand on their own; for example, the News table, which stores news articles. This table doesn’t link to data stored in any other table. Notice also that the Orders, Products, and OrderLines tables are separate from the rest of the database — these tables are used to store data relating to orders from the Wrox United shop.
This appendix walks through the structure of each of the tables in the database and describes the relationships between them.
Players and Matches
The players on the Wrox United team are involved in many fixtures, and several related tables in the database store related data for matches. Take a look at these tables first.
The Players Table
The structure of the Players table is as follows:
Field |
Data Type |
Allow Nulls |
|
|
|
PlayerID (Primary Key) |
int |
No |
FirstName |
varchar(25) |
No |
LastName |
varchar(25) |
No |
Position |
varchar(50) |
Yes |
PictureURL |
varchar(255) |
Yes |
DateJoined |
datetime |
Yes |
DateLeft |
datetime |
Yes |
This table is typical of all database tables in that it has the following:
A primary key field that uniquely identifies each row in the database.
Fields designed to store textual data about each player (in varchar fields).
Fields that store date and time information.
Flags indicating whether or not different fields require values.
In this table, the primary key is the PlayerID field, which stores numeric values (integers) that are unique to each player in the database. This field, along with the FirstName and LastName fields, is marked as not allowing null values; in other words, if you enter a row of data in the table, you must