When designing a database, poor structure leads to data redundancy (duplicate data), update anomalies, and wasted storage. Normalisation is the process of organising tables to minimise these problems.
First Normal Form (1NF)
• Each cell contains only atomic (single, indivisible) values
• There are no repeating groups or arrays
• Each record is unique (has a primary key)
NOT in 1NF (repeating groups):
| StudentID | Name | Courses |
|---|---|---|
| S001 | Alice | Maths, Physics, Chemistry |
| S002 | Bob | Maths, Biology |
IN 1NF (atomic values):
| StudentID | Name | Course |
|---|---|---|
| S001 | Alice | Maths |
| S001 | Alice | Physics |
| S001 | Alice | Chemistry |
| S002 | Bob | Maths |
| S002 | Bob | Biology |
Second Normal Form (2NF)
• It is already in 1NF
• All non-key attributes are fully dependent on the ENTIRE primary key (no partial dependencies)
IN 1NF but NOT 2NF:
| StudentID | CourseID | StudentName | CourseName | Grade |
|---|---|---|---|---|
| S001 | C001 | Alice | Maths | A |
| S001 | C002 | Alice | Physics | B |
| S002 | C001 | Bob | Maths | B |
Problem: StudentName depends only on StudentID, not CourseID. CourseName depends only on CourseID, not StudentID. These are PARTIAL dependencies.
IN 2NF (split into separate tables):
Student Table:
| StudentID | StudentName |
|---|---|
| S001 | Alice |
| S002 | Bob |
| CourseID | CourseName |
|---|---|
| C001 | Maths |
| C002 | Physics |
| StudentID | CourseID | Grade |
|---|---|---|
| S001 | C001 | A |
| S001 | C002 | B |
| S002 | C001 | B |
Third Normal Form (3NF)
• It is already in 2NF
• No non-key attribute depends on another non-key attribute (no transitive dependencies)
IN 2NF but NOT 3NF:
| StudentID | Name | TutorID | TutorName | TutorOffice |
|---|---|---|---|---|
| S001 | Alice | T01 | Mr Brown | Room 12 |
| S002 | Bob | T01 | Mr Brown | Room 12 |
| S003 | Charlie | T02 | Ms Green | Room 15 |
IN 3NF (remove transitive dependency):
Student Table:
| StudentID | Name | TutorID |
|---|---|---|
| S001 | Alice | T01 |
| S002 | Bob | T01 |
| S003 | Charlie | T02 |
| TutorID | TutorName | TutorOffice |
|---|---|---|
| T01 | Mr Brown | Room 12 |
| T02 | Ms Green | Room 15 |
• Reduces data redundancy (no duplicate data)
• Prevents update anomalies (change once, applies everywhere)
• Saves storage space
• Improves data integrity
• Makes database easier to maintain