You are on page 1of 6

Databases

A computerised database stores data in one or more organised tables. Because the data
is stored in named fields it has a context so it becomes information. Database software
is designed to make it easy and efficient to store, edit, sort and search information.

Database terminology:
Field - a field is used to store an individual item of data.
Example: typical fields might be 'surname', 'colour', 'height', 'DOB' etc.

Key Field - a field that is unique for each record in the database and can therefore be
used to identify just that record.
Example: A field like 'surname' would not make a good key field because two records in a
database of people could easily have the same surname.

Record - a record is a group of related fields.


Example: In a database of doctor's patients, each patient would be a separate record,
with fields for 'surname', 'DOB', 'address', 'allergies' etc.

File - a file is the group of records that make up the database.

Examples of use:
Whitefield school has a database with all the pupil details on it.
The whole database is a file.
Each pupil is a separate record in the file
Each record is made up of fields such as 'first name', 'surname', 'DOB', 'tutor group',
'emergency contact number', 'tutor group' etc.
The key field is the unique 'admin number' given to each pupil when they join the school.

Data Types:
When a database is designed, all the fields are set to accept a particular data type.
This helps check for the wrong type of data being entered and makes sure the data is
stored as efficiently as possible. It also means it will be sorted correctly.

Alphanumeric/text - a field of this data type will accept both numbers and text.
When to use - if you want to enter text or a mixture of text and numbers.
When NOT to use - if you want to store only numbers or only dates. You can enter
numbers or dates into text fields but they would get sorted as if they were words and
could not easily be used for any calculations.

Numeric - a field of this data type is used to store numbers. There are two types of
numeric field you need to know about:

Real - used for decimal numbers such as 3.4, 3.1427 and 6.0 etc. Real numbers can be
formatted as currency (i.e. £5.67) or to a fixed number of decimal places (i.e. entering
3.1427 into a real number field formatted to two decimal places would mean it appeared
as 3.14)
When to use - if the field is going to be used to store numbers with decimal places such
as 'height', 'length' etc.
Integer - used for whole numbers.
When to use - if the field is only going to be used to store whole numbers, i.e. 'number
of children', 'car doors' etc.

Logical/Boolean - a field of this data type will only let you enter a 'Yes' or a 'No'. This
may be as text (YES/NO or TRUE/FALSE) or as a tick/blank.
When to use - when you only need to store something as 'true' or 'false' or store
whether something exists or does not exist.

Date - this special field stores days, months and years so that records can be sorted
correctly. Date fields can display the date information in different formats such as the
full name of the day/month (28th August 1961) or the numerical versions (28/08/61)
When to use - for any field which will be used to store date information.

Examples of use:
A football club uses a database to store details of its players.
• Data such as Surname and First name is stored in text fields.
• The players car registration is mixture of text and numbers so it is stored in a
text field.
• The height of the player (in metres) is a decimal number so it is stored in a real
number field.
• The number of goals scored is a whole number so it is stored in an integer
number field.
• The player's date of birth (DOB) is a date so it is stored in a date field.
• The players telephone number has a space between the code and the actual
number so it is stored in a text field.
• Information such whether the player is right or left footed is stored using a
logical/Boolean field. The field is labelled as 'Right footed?' and the entry is
either a TICK or left blank.

Examination questions on this topic


You will often get a question about a table from a database. It can be very easy to mix
up a question about field names with one about field data types.

For example:
Item Stock code Size (cm) Manufacturer Date purchased Plastic?
Hose clip T0090 0.90 Fisher 28-07-2002 No
Hose clip T0135 1.35 Fisher 28-07-2002 No
Joining clip K0118 0.90 Asus 28-04-2001 Yes
Extension hose L0035 100.00 Fisher 28-02-2000 Yes

If you are asked to name a field then look the row at the top which should have all the
field names. In this example, 'Item', 'Stock code' etc. are the field names.
If you are asked to identify the key field then look for a column of numbers or
numbers/text that identifies each item uniquely. In this example the 'stock code' is
the key field as each item in stock would be given a unique code to avoid confusing it
with any other item.

If you are asked to describe a suitable data type for a particular field then you must
look at the type of data being stored in each column.
If the data is text or a mixture of text & numbers (including spaces or brackets etc.)
then the data type would be text.

If the data is numeric then the data type would be numeric but you also need to say if it
should be real or integer. (Remember, use real if the data has decimal places and
integer when all the data is whole numbers)

If the data is in the form of a date then the data type would be date. It does not
matter if the date is stored in a numeric form (i.e. 28-08-61 or 28/8/1961) or written
out fully (i.e.28th August 1961).

If the data seems to have only two options, particularly 'yes' or 'no' then the data
type should be logical/Boolean.

For the example table above, the field names and data types would be as follows:
Field Date
Item Stock code Size (cm) Manufacturer Plastic?
name purchased
Data Text (key Numeric
Text Text Date logical/Boolean
type field) (real)

TASK complete the following past exam questions


http://www.waingels.wokingham.sch.uk/Departments/IT/Resources/DatabaseApplications2000.doc

1 The school office computer has a database of pupils. [1]


Give one occasion when a pupil’s record will need to be inserted into the database.

2 Data about pupils is stored in a datafile [4]

Give one reason why the date of birth is stored and not the age of a pupil.

Give one reason why each record has a record number.


Give one reason why the data for Male or Female is coded M or F.

Give one reason why the data is validated.

3 A large database is being created [4]

Describe two ways of verifying the data

4 When using a software package a four digit number has to be entered. [2]
Describe two validation checks which should be used on the number.

5 Describe what would happen if the number was allowed to be entered incorrectly.
[1]

6 The school office computer has a database of pupils State two ways in which pupil
records can be protected from unauthorised access. [2]

The database shows some items of equipment in a science laboratory, their cost and on
what shelf they are located.

Item Quantity Cost (p) Shelf


test tube 57 42 A
stand 6 83 B
tripod 14 12 G
bunsen burner 12 240 C
rubber pipes 27 98 G
flask 17 56 B
beaker 18 45 A
jug 9 34 G
thermometer 22 120 D
heat mat 20 79 G

1 Which item or items will be listed if the following search condition is input?
Quantity > 20 AND Shelf = “G”

[1]
2 Write down a search condition which would find all the items on shelf B which
cost less than 40 pence.
[3]

3 Describe the steps which should be taken to produce a printout to check the
stock on the shelves.

[2]

4 A school records details of pupils on a computer database. The following data is


stored. Surname, Forename, Form, Age, Home address.
State one reason why it is not advisable to store a pupil’s age.
[1]

5 State how you would overcome this problem.


[2]

6 State why you would use more than one field for storing the home address.
[1]

7 The secretary has to type the pupil details into the database. State two ways of
verifying the data.
[2]

8 Give two occasions when a pupil’s record will need to be altered. [2]

9 Employees of a company have to enter 4 figure code numbers into a data handling
package.
State two validation checks which could be used to check that the validation of
the code numbers is working.
[2]

10 If the code number was not validated, incorrect data would be entered into the
database causing problems. State one example of such a problem.
[1]

You might also like