A database is a way of storing informationinformation: data with context or meaning in an organised, logical way. It's important to know when to use a database and be aware of its advantages.
Before setting up a database [database: a structured collection of records or data stored in a computer system ], the record structure must be decided to make best use of the memorymemory: Where a program or data is stored on a computer. and backing store [backing store: a 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:
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 fieldkey field: a unique identifier for a database record or table entry |
| 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 [data: information without context, eg a list of students with numbers beside their names is data, when it's made clear that those numbers represent their placing in a 100 metre race, the data becomes information ] 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 key field is a unique identifier for each record.
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.
| Registration number | Make | Model | Date first registered | Price | Taxed |
|---|---|---|---|---|---|
| R623 PHM | Ford | Fiesta | 010198 | 6800 | Y |
| P887 LHW | Rover | 200 | 010397 | 7500 | Y |
| P812 WHJ | Peugeot | 406 | 010996 | 7000 | N |
A database in which all the data is stored in a single table is known as a flat file database.
BBC © 2012 The BBC is not responsible for the content of external sites. Read more.
This page is best viewed in an up-to-date web browser with style sheets (CSS) enabled. While you will be able to view the content of this page in your current browser, you will not be able to get the full visual experience. Please consider upgrading your browser software or enabling style sheets (CSS) if you are able to do so.