For example, a car showroom wants to record details of the cars it sells. Before setting up the database, the following questions need to be answered:
With these questions answered, informed decisions can be made about the record structure. This is how it might begin:
|Field name||Field type||Format|
|Registration number||Alphanumeric||Up to 7 characters - the key field|
|Make||Alphanumeric||Up to 15 characters|
|Model||Alphanumeric||Up to 15 characters|
|Date first registered||Date||DDMMYY|
|Price||Currency||Up to 5 numbers|
|Taxed||Yes/No (Boolean)||1 character Y/N|
When designing a database it is important to choose the correct field type. This ensures that the data stored is usable and it makes validation easier. For example, if the price paid for goods was stored in a text field, then the database wouldn’t be able to add each individual figure to produce a total.
A database should always contain a key field.
The following are examples of key fields:
Databases store data in tables, a single database file can store many tables, queries and reports. In the example table below there are six columns (divided vertically) and four rows (divided horizontally), each column has a heading, eg Registration number.
|Reg. number||Make||Model||Date registered||Price||Taxed|
A database in which all the data is stored in a single table is known as a flat file database.