Download as ppt
Download as ppt
You are on page 1of 18

Databases

©www.teach-ict.com
What is a database?
Surname: James
First name: Samantha
Surname: Brown
Date of Birth: 20.12.89
First name:
Surname: David
Lastler
Address: 16 Poppy Close
Date
Firstofname:
Birth: 20.12.89
David
Town: Southam
Address:
Date of Birth: Surname:1620.12.89 Whitefield
Poppy Close
County: Warwickshire
Address: First name:
Town: Southam Nina
16 Poppy Close
County:
Town: Date of Birth:
Southam 21.02.76
Warwickshire
County: Address: Warwickshire
16 Poppy Close
Town: Southam
County: Warwickshire

A database is a collection of data organised


into a ©www.teach-ict.com
structured format.
Paper based databases
Examples:
•Telephone directory
•Address book
•Card index system
•Details of car repairs
•Customer returns book

The word ‘Database’ is often linked to data


held©www.teach-ict.com
on a computer.
Retrieving information
Main difference between paper and computerised
databases is speed the data can be accessed.

Computerised databases make it possible to


analyse data collected.

•Shops – customer purchases


•Health authorities – link illnesses to factors e.g. diet
•Police – build up profiles of crimes/criminals

©www.teach-ict.com
Flat files
A flat file is a database held in a single file.
A spreadsheet can be used as a flat file database.

Video Title Country Date Classificatio Rental


no. released n price
1 Lord of the Rings US 2001 12 3.50

2 Attack of the Clones US 2002 PG 2.99

3 About a boy UK 2002 U 2.99

4 Crocodile Dundee AUS 1986 15 1.50

5 Die another day UK 2002 12 2.99

6 Shrek US 2001 U 1.99

Record
Field
©www.teach-ict.com
File
Flat files - Uses
Flat files are useful for:
-Lists of contact names and addresses
-Lists of student grades
-Details of a video collection

However data stored in one flat file cannot


easily be linked to data stored in another flat
file.
©www.teach-ict.com
Flat files - Problems

There are several drawbacks to holding


anything except very simple data in a single
flat file.

Have a look at the example and try to find


some of the problems which exist with
using a flat file as a database.

©www.teach-ict.com
Redundant data

There is a vast amount of repeated data.

This wastes disk space and slows the


database down.

Data entry is time consuming

©www.teach-ict.com
Errors on input
Typographical errors occur when data is
entered needlessly.

This will affect the quality of the database


and the results of queries and data analysis.

©www.teach-ict.com
Problems with updating data
If Miss Smith gets married and changes her
name, every record would have to be
updated.

If a lecturer left and a new one was


employed, every record for students taking
that course would have to be updated.

©www.teach-ict.com
Overcoming problems with Flat files

Not all of the data needs to be entered every


time. Some of it could be moved to other
tables and accessed when required.

Which data do you think could be moved to


separate tables?

©www.teach-ict.com
Using multiple tables
The student data could be moved into a
separate table as follows:

Student Student Student Date enrolled Course code


ID forename surname
1 Philip Harris 30/08/2002 119
2 Michael Jenner 09/09/2002 115
3 Ian Bemrose 07/09/2002 119
4 Meena Akbar 12/09/2002 118
5 James Payne 09/09/2002 115
6 Campbell Naeve 12/10/2002 114

©www.teach-ict.com
Using multiple tables
The course data could be moved into a
separate table as follows

Course Course title


Code
114 Physics

115 Chemistry

118 Applied Science

119 Chemistry

©www.teach-ict.com
Using multiple tables
The subject information could be moved into
a separate table as follows

Subject Subject Day Period Lecturer


ID Name ID
14 Physiology Tuesday 3 1
15 Atoms Tuesday 5 2
16 Electrons Monday 4 3
17 Particles Wednesda 3 4
y

©www.teach-ict.com
Using multiple tables
The lecturer information could be moved into
a separate table as follows:
Lecture Lecturer Date
r ID Name employed
1 Meaner 03/11/199
5
2 Maynard 01/02/200
2
3 Noakes 09/10/199
9
4 Smith 14/12/200
2

A unique ID has been assigned to each lecturer, since if


two people were hired with the same name, it would be
impossible to distinguish between them.
©www.teach-ict.com
Using multiple tables
Note that this structure does not currently allow
students to take more than one subject.
In order to do that, another table will be required.
Student Student ID Subject
_subjec ID
tID
001 1 14

002 1 15

003 2 14

004 3 14

005 3 16

006 4 15
007 4 16
©www.teach-ict.com
Problems solved

•Redundant data has been reduced.


•Risk of errors reduced
•Modifying and updating data problems
resolved

©www.teach-ict.com
Flat file information storage and retrieval systems

Read page 95 of Heathcote and write a


paragraph explaining the advantages of a
‘database system’ over the ‘traditional file
approach’

©www.teach-ict.com

You might also like