INVOICE
Database As illustrated in the diagram below, the INVOICE
database consists of four linked tables.
The table CUSTOMER
is linked to table INVOICE
by the use of a primary key and foreign key.
A primary key is a field that uniquely identifies a record in a table. Some examples are:
In the above tables the primary keys are in bold.
A foreign key is the primary key from one table that is placed into another table, in order to create a relationship between the two tables.
Each of the relationships in the INVOICE
database is a one-to-many (1-∞). That is, a record in one table can have one or more related records in another table. For example, one customer can have many invoices, but, an invoice only ever belongs to one customer. There are three types of relationships:
Relationships will be covered in depth in the second module, so do not be overly concerned about them at the moment.
The field CustABN
is the primary key in CUSTOMER
and also exists in INVOICE
as a foreign key, where it connects each invoice to its customer.
Nearly all of the practical work in this unit is based on this database and by developing the INVOICE
database, you will gain an understanding of how: