As ICT Relational Databases
As ICT Relational Databases
As ICT Relational Databases
Objectives
Evaluate the difference between a flat file and a relational
database and why one might be preferred in certain situations.
When you first set up your database, you can choose to make a 'flat-
file' database or a 'relational' database.
With a flat file database, all your data is stored in one large table.
Take a database that a vet might use. In our example on the right,
there is data about the owner of the pet i.e. name, address, phone
number, there is data about the pet - name, type of animal, date of
birth, and there is also data about any appointments the pet has.
Flat file database
• Every single time the pet has an appointment, the customer's title, surname,
street, town, county, and phone number must be entered. Also, the pet's
name, type and d.o.b. also must be entered.
• That would get tiresome having to enter so much data each time and there
would be a great risk of making a mistake - remember GIGO.
In the database below, the data is split up into sensible groups i.e. customer
data, pet's data and appointments data. Then a separate table is made for each
group.
Relational databases
Once the tables have been set up, a relationship can be created to link them
together - as shown by the lines linking the tables below.
When a customer books an appointment for their pet, a new record is created
on the 'appointment's table' and the relevant Customer and Pet IDs are chosen.
It also reduces the risk of mistakes, because every time you must type the same
data in, there is a risk you could mis-spell it.
Plenary
Car
Learner
Lesson
LearnerID(PK)
LessonID(PK) Registration(PK)
Forename
LessonDate Make
Surname
TimeSlotStart Model
Telephone
Registration(PK) RegYear
LearnerID(FK) Transmission
Salesperson Table Products Table
SalesPersonID(PK) ProductID(PK)
FirstName ProductName
Shop NoOfProducts
Manufacturer
SalesPersonID(FK)