Databases and data capture
Before setting up a databaseA data store designed in an organised way, making it easier to search for the information you need., the record structure must be decided to make best use of the memoryThe part of a computer that stores data. and backing storeA computer's primary data store, ie the hard disk., and to make searching and report creation easier.
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:
- What information is needed?
- What validationChecking input data is sensible and in the right format. could there be?
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 |
Field name | Registration number |
---|---|
Field type | Alphanumeric |
Format | Up to 7 characters - the key field |
Field name | Make |
---|---|
Field type | Alphanumeric |
Format | Up to 15 characters |
Field name | Model |
---|---|
Field type | Alphanumeric |
Format | Up to 15 characters |
Field name | Date first registered |
---|---|
Field type | Date |
Format | DDMMYY |
Field name | Price |
---|---|
Field type | Currency |
Format | Up to 5 numbers |
Field name | Taxed |
---|---|
Field type | Yes/No (Boolean) |
Format | 1 character Y/N |
When designing a database it is important to choose the correct field type. This ensures that the dataValues, typically letters or numbers. 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鈥檛 be able to add each individual figure to produce a total.
Key fields
A database should always contain a key field.
The following are examples of key fields:
- car registration number
- National Insurance number
- your school's examination centre number
- your own examination candidate number
Storing data in tables
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 |
R623 PHM | Ford | Fiesta | 010198 | 6800 | Y |
P887 LHW | Rover | 200 | 010397 | 7500 | Y |
P812 WHJ | Peugeot | 406 | 010996 | 7000 | N |
Reg. number | R623 PHM |
---|---|
Make | Ford |
Model | Fiesta |
Date registered | 010198 |
Price | 6800 |
Taxed | Y |
Reg. number | P887 LHW |
---|---|
Make | Rover |
Model | 200 |
Date registered | 010397 |
Price | 7500 |
Taxed | Y |
Reg. number | P812 WHJ |
---|---|
Make | Peugeot |
Model | 406 |
Date registered | 010996 |
Price | 7000 |
Taxed | N |
A database in which all the data is stored in a single table is known as a flat file database.