Advanced

Database Normalisation

AicademyAicademy
·A-Level Computer Science·AQA 7517·5 min
4.10.3 Database design and normalisation

Why Normalise?

Normalisation is the process of organising a database to eliminate redundancy (data stored more than once) and improve integrity (data stays consistent).

Problems caused by un-normalised data:

AnomalyWhat goes wrong
Update anomalyThe same data is stored in multiple rows; updating one but not the others causes inconsistency
Insertion anomalyCannot add data without also providing unrelated data (e.g. can't add a course unless at least one student is enrolled)
Deletion anomalyDeleting one record accidentally deletes other useful data (e.g. deleting the last student in a course also deletes the course itself)

Normalisation solves all three by ensuring each fact is stored in exactly one place.

First Normal Form (1NF)

A table is in 1NF if:

  1. Each cell contains a single (atomic) value — no repeating groups or multi-valued cells
  2. Each column contains values of the same type
  3. Each row is unique (there is a primary key)

Un-normalised table:

OrderIDCustomerProducts
1AlicePen, Notebook
2BobRuler

Products contains multiple values — violates 1NF.

1NF version:

OrderIDCustomerProduct
1AlicePen
1AliceNotebook
2BobRuler

Each cell now contains one value. The primary key is now (OrderID, Product) — a composite key.

Second Normal Form (2NF)

A table is in 2NF if:

  1. It is in 1NF, and
  2. Every non-key attribute depends on the whole primary key — no partial dependencies

Partial dependency occurs when a non-key attribute depends on only part of a composite primary key.

1NF table (from above) — checking for partial dependencies:

OrderIDProductCustomerProductPrice
1PenAlice£0.50
1NotebookAlice£2.00
2RulerBob£1.50
  • Customer depends only on OrderID (not on Product) — partial dependency
  • ProductPrice depends only on Product (not on OrderID) — partial dependency

2NF: remove partial dependencies into separate tables:

Order(<u>OrderID</u>, Customer)
Product(<u>Product</u>, ProductPrice)
OrderLine(<u>OrderID*</u>, <u>Product*</u>)

Each non-key attribute now depends on the whole primary key of its table.

Third Normal Form (3NF)

A table is in 3NF if:

  1. It is in 2NF, and
  2. No non-key attribute depends on another non-key attribute — no transitive dependencies

Transitive dependency: A → B → C, where A is the primary key, B and C are non-key attributes, and C depends on B rather than directly on A.

Example — 2NF table with transitive dependency:

EmployeeIDDeptCodeDeptNameSalary
101ITIT Department£40000
102HRHR Department£35000
103ITIT Department£42000
  • DeptName depends on DeptCode (non-key), not directly on EmployeeIDtransitive dependency

3NF: remove transitive dependencies:

Employee(<u>EmployeeID</u>, DeptCode*, Salary)
Department(<u>DeptCode</u>, DeptName)

Now DeptName is stored once in Department. Changing a department's name requires updating one row.

How much of this have you taken in?

Quiz yourself on this section — free, no card needed.

Test myself

Normalisation: Step-by-Step Summary

Normal FormRequirementResolves
1NFAtomic values; unique rows; primary keyRepeating groups and multi-valued cells
2NF1NF + no partial dependenciesNon-key attributes depending on part of composite key
3NF2NF + no transitive dependenciesNon-key attributes depending on other non-key attributes

The process:

  1. Start with the un-normalised data
  2. Apply 1NF: split out multi-valued cells; identify primary key
  3. Apply 2NF: identify partial dependencies; move them to new tables
  4. Apply 3NF: identify transitive dependencies; move them to new tables

Common Exam Mistakes

1. Skipping 2NF for tables with a single-column primary key

Partial dependencies only exist when there is a composite primary key. A table with a single-column primary key is automatically in 2NF (you cannot have a partial dependency on a single column). The 2NF step matters only when there is a composite key.

2. Confusing partial and transitive dependencies

Partial dependency (2NF issue): non-key attribute depends on part of the composite primary key. Transitive dependency (3NF issue): non-key attribute depends on another non-key attribute. Draw the dependency chain: if the chain goes key → non-key → non-key, it is transitive.

3. Applying normalisation without identifying the primary key first

You cannot check for 2NF or 3NF without knowing the primary key. The first step in normalisation is always to identify the key. All subsequent dependency analysis is relative to the key.

4. Forgetting that normalisation creates more tables

Normalising a table produces more, smaller tables. Queries on a normalised database require JOINs. This is a deliberate trade-off: more tables, less redundancy, better integrity. Denormalisation (deliberately introducing some redundancy) is sometimes done for performance — but that is beyond the AQA spec.

Generate revision on any topic you study

Type any topic you're studying and Aicademy generates a complete lesson, quiz, and flashcard set — personalised to your level.

Lessons on anything

Structured, level-matched lessons on any topic you study

Practice quizzes

Find out what you actually know before the exam does

Flashcard sets

Lock in key concepts with instant revision cards

Ask Aica

Stuck on something? Get a clear explanation, any time

Prev

Entity-Relationship Modelling and Relational Databases

Next

SQL and Client-Server Databases

Related lessons

6 Slides

Lesson

Entity-Relationship Modelling and Relational Databases

A-Level Computer Science · AQA 7517

10 hours ago

6 Slides

Lesson

SQL and Client-Server Databases

A-Level Computer Science · AQA 7517

10 hours ago