database structure

17

Upload: forrester-high-school

Post on 10-Jan-2017

656 views

Category:

Education


1 download

TRANSCRIPT

Page 1: Database structure
Page 2: Database structure

Database Structure A database is a system for organising and storing data Databases are made up of one or more files Files are a collection of records, and records are made up of fields.

Page 3: Database structure

Database Structure A database is a system for organising and storing data Databases are made up of one or more files Files are a collection of records, and records are made up of fields.

Page 4: Database structure

Database Structure Each column represents a field

Each row represents a record

Page 5: Database structure

Flat File Database A flat-file database is a database structure which consists of only a

single table.

While this is a simple way to store files, a flat-file system becomes increasingly inefficient as more data is added.

Page 6: Database structure

Database AnomaliesWhilst the flat-file database might seem to be a good solution to begin with, there are actually a number of problems which are linked with this approach.

These are known as anomalies.

Page 7: Database structure

Database AnomaliesAnomaly 1:Mr O'Hara is a teacher in the English department and he teaches in English Room 4. Add Mr O'Hara's details to the database.

Page 8: Database structure

Database AnomaliesAnomaly 1:Mr O'Hara is a teacher in the English department and he teaches in English Room 4. Add Mr O'Hara's details to the database.

This is known as an insertion anomaly.

Page 9: Database structure

Database AnomaliesAnomaly 2:The art department is reorganising rooms and Miss Dewar is moving from Art Room 3 to Art Room 1. Update the database to show this.

Page 10: Database structure

Database AnomaliesAnomaly 2:The art department is reorganising rooms and Miss Dewar is moving from Art Room 3 to Art Room 1. Update the database to show this.

This is known as an update anomaly.

Page 11: Database structure

Database AnomaliesAnomaly 3:John McGinn has left school. His record should be deleted from the database.

Page 12: Database structure

Database AnomaliesAnomaly 3:John McGinn has left school. His record should be deleted from the database.

This is known as a deletion anomaly.

Page 13: Database structure

Relational DatabasesA better approach to database design is known as the Relational Database Model. In the relational model, the data is stored in multiple tables or relations.

However, in this example we have lost the link between pupil and their tutor teacher.

Page 14: Database structure

Relational DatabasesWe create linked tables by introducing keys.

Page 15: Database structure

Relational DatabasesWe create linked tables by introducing keys.

Page 16: Database structure

Atomic DataData items are said to be atomic if they cannot be broken down into smaller data items.

In this example, Forename and Surname fields are atomic because they cannot be broken down into smaller data items:

Page 17: Database structure

Atomic DataData items are said to be atomic if they cannot be broken down into smaller data items.

In this example, the Pupil Name field is not atomic because it could be further broken down into fields - Forename and Surname: