Storing data in tables
Databases store data in tables. Tables are made up of fields and records.
A prison might use a database to keep records of its inmates. A criminal’s record may contain the following fields:
- first name
- last name
- height
- crime
- release date
A table consists of related records, eg people convicted of a crime, and a record consists of related fields, eg Paul Smith who is 1.8 m, committed a robbery and is being released on 26.01.2015.
Creating a table
To create a table in Microsoft Office Access, use Design view. Start by writing a list of sensible field names, eg ‘Crime’ would be a better field name than ‘Act of questionable judgement’ because ‘Crime’ is short and to the point.
Data types
Access will automatically choose a field’s dataValues, typically letters or numbers. type based on the data entered. For example, if a phone number is entered into a field its data type will be automatically set to 'Number'. Other data types include:
- 'text' – writing
- 'date/time' – date or time
- 'currency' – euro, pound, dollar, etc
- 'autonumber' – number increases by one each time
- 'yes/no' – only yes or no can be entered
Setting a primary key
The primary key is a field that contains data that is unique for each record. A car dealership may use a car's registration or number plate as a primary field to set apart two cars of the same colour, make and model.