Presentation is loading. Please wait.

Presentation is loading. Please wait.

Flat file and relational databases 3.3.9. Flat file database In a flat file database information is held in a single table. Student IDStudent name GenderDOBCourse.

Similar presentations


Presentation on theme: "Flat file and relational databases 3.3.9. Flat file database In a flat file database information is held in a single table. Student IDStudent name GenderDOBCourse."— Presentation transcript:

1 Flat file and relational databases 3.3.9

2 Flat file database In a flat file database information is held in a single table. Student IDStudent name GenderDOBCourse IDCourse nameTeacher IDTeacher name 67678Jim SmithM30/01/20F451Computer fundamentals 4445Mr Surrall 67677Jane JonesF02/01/20F451Computer fundamentals 4445Mr Surrall 67678Jim SmithM30/01/20F452Programming & logic 4433Mr Surrall 67222Lucy KidF08/03/20F452Programming & logic 4445Mr Surrall

3 Flat file databases This presents three main problems: ● Lots of data is duplicated wasting memory. ● The same changes need to be made in lots of places if data needs updating. ● Very inefficient if you want to add new data ie a teachers e-mail address

4 Relational databases Relational databases were created to remove the problems with flat file databases. Relational databases are made up of lots of smaller tables linked together using Primary & Foreign keys.

5 Studen t ID Studen t name GenderDOBCourse numbe r 67678Jim Smith M30/01/ 20 F451 67677Jane Jones F02/01/ 20 F451 67678Jim Smith M30/01/ 20 F452 67222Lucy Kid F08/03/ 20 F452 Course IDCourse name Teacher ID Teacher name F451Computer fundament als 4445Mr Surrall F452Programmi ng & logic 4445Mr Surrall The Primary Key is a unique identifier. The Foreign key is the field that links to the Primary key in another table Students Course

6 Normalisation The process of converting a flat file database into a relational one is called normalisation. There are three stages in this normalisation called normal forms.

7 First normal form (1NF) A table is in first normal form if it contains no repeating attributes or groups of attributes.

8 Studen t ID Studen t name GenderDOBCourse numbe r 67678Jim Smith M30/01/ 20 F451 67677Jane Jones F02/01/ 20 F451 67678Jim Smith M30/01/ 20 F452 67222Lucy Kid F08/03/ 20 F452 Course IDCourse name Teacher ID F451Computer fundament als 4445 F452Programmi ng & logic 4445 Teacher ID Teacher name 4445Mr Surrall Students CourseTeacher

9 Second normal form (2NF) A table is in second normal form if it is in first normal form and no column which is not part of the primary key is dependant on only a portion of the primary key.

10 Studen t ID Studen t name GenderDOB 67678Jim Smith M30/01/ 20 67677Jane Jones F02/01/ 20 67222Lucy Kid F08/03/ 20 Course IDCourse name Teacher ID F451Computer fundament als 4445 F452Programmi ng & logic 4445 Teacher ID Teacher name 4445Mr Surrall Student ID Course number 67678F451 67677F451 67678F452 67222F452 StudentsEnrollment Course Teacher

11 Third normal form A table is in third normal form if it is in second normal form and contains no column that is not directly related to the primary key. A table is in third normal form if it contains no ‘non-key dependencies’

12 Studen t ID Studen t name GenderDOB 67678Jim Smith M30/01/ 20 67677Jane Jones F02/01/ 20 67222Lucy Kid F08/03/ 20 Course IDCourse name F451Computer fundament als F452Programmi ng & logic Teacher ID Teacher name 4445Mr Surrall Student ID Course number 67678F451 67677F451 67678F452 67222F452 Course ID Teacher ID F4514445 F4524445 StudentsEnrollment CourseStaff Teacher


Download ppt "Flat file and relational databases 3.3.9. Flat file database In a flat file database information is held in a single table. Student IDStudent name GenderDOBCourse."

Similar presentations


Ads by Google