Database
Database
Databases
Types of Data
Boolean data types only have one of two values: True or False
Examples:
Yes or No 1 or 0 On or Off
Alphanumeric/Text Data
1- Text Data
Example:
2- Alphanumeric Data
Alphanumeric data refers to the data that is made up of a combination of letters AND
numbers.
Example:
The password ‘MIKE62’ contains letters and numbers and is therefore alphanumeric.
Note:
Other symbols such as @, $, # and spaces etc, are also regarded as alphanumeric data.
Note:
The above examples show you the true meaning of Text and Alphanumeric values.
However, in most applications, Text data types will also handle Alphanumeric data.
1
IGCSE ICT 0983
Numeric Data
Q: Why does the computer need to know if the number is integer or real?
A: Because real numbers take up more space. If a database file has a million records, this can
represent a lot of wasted space.
Q: Why telephone Numbers are not numeric?
A: Because they often contain leading zeros (e.g 002)
Currency Numbers
Currency are Real Numbers (decimals) that are formatted to include money symbols (£, $
etc).
Currency values are usually shown with 2 decimal places.
Currency values can be positive and negative
Examples:
£12.45
-£0.01
€999.00
$5500
Percentage Numbers
Percentage refers to fractional real numbers that are formatted in a specific way - out of 100, with
a percent symbol.
Examples:
2
IGCSE ICT 0983
Date/Time Data
Data is to be stored in a structure and to do this a data type must be chosen for each item of data.
Choose a suitable data type from the following list for the data shown in the table:
Logical/Boolean Alphanumeric/text Numeric Date Currency
3
IGCSE ICT 0983
Database Structure
Note:
Data is often stored in files, which consist of records, which in turn consist of fields.
Example of a Database
Our school holds lots of information about students on its database. Let’s take a look at the data we
might hold.
Notice how each student has similar information stored about them. For example, Name and D.o.B.
We want to store this information in an organised way so that we can access it easily. In other
words we want a database.
What is a Record?
4
IGCSE ICT 0983
What is a Field?
5
IGCSE ICT 0983
Pupil records are kept on a computer in the school office. Here is a part of a file of year 12 student
records.
(a) Write down the name of the field which would be used as the key field. [1]
Exam Number
(b) Why would it be used? [1]
Age for each student changes every year and so database file will need to be continually
updated.
6
IGCSE ICT 0983
A school uses a database to store records about its students. Describe a situation where a record on
the database would need to be:
(a) Inserted [1]
Example
7
IGCSE ICT 0983
Q: In the patient database below, write the field names that contain duplicate of data?
A: Doctor ID, Doctor and Room.
Relational Database
Definition: Relational Database - a database where the data is held in two or more tables with
relationships (links) established between them.
Example:
How can we know the name of each patient’s doctor if they are no longer in the Patient Table?
The Answer is to link the 2 tables using relationships.
8
IGCSE ICT 0983
A foreign key is a field of one table which is also the primary key of another.
Foreign keys are used to provide the link (relationship) between the tables.
In our patient database, Doctor Id is a key field in the Doctor Table but is also being used in
the Patient Table as a foreign key:
More complex than a flat file database as more tables are required
Takes more time to set up
More of a reduction in performance if many tables are needed
Less robust due to broken keys and records / each table requires a key field and relationships
to other tables
More developer expertise / personnel to run the database:
More expensive to create a relational database
More processing power needed for complex queries.
9
IGCSE ICT 0983
Validation is a process where data is checked to see if it satisfies certain criteria when input into a
computer, for example to see if the data falls within accepted boundaries.
10
IGCSE ICT 0983
Verification
Verification means to check that the data on the original source document is identical to the data
that you have entered into the system or object document.
There are two ways that verification checks are carried out:
Data is typed in twice by one typist or data is typed in by two operators and computer compares
versions. If different freezes/sounds buzzer.
Visual check
This is the checking for errors by comparing entered data on the screen with the data in the original
document
A school library has a file for storing details of the books and it has a file for storing details of its
borrowers. The two files are linked using a common field.
(a) How many records are there in the book file? [1]
4 Records
(b) How many fields are there in the borrower file? [1]
5 fields
(c) What type of database do these two files form? [1]
Relational database
11
IGCSE ICT 0417
(d) Give two reasons why this type of database system is used rather than having two flat
files.[2]
(e) Which field is the primary key in the Book file? [1]
Code
Book Borrowed
Cost
(h) What data type would be most appropriate for the Due Back field? [1]
Date
Tick whether the following statements are true or false about student records in a database. [4]
The same value can occur several times within a key field. [False]
12