AQA GCSE CSPaper 2 · Unit 7Lesson 1

Paper 2 · Unit 7 · CS-L7-01

Databases & Flat Files

60 minutes · AQA 8525 · Paper 2 — Relational databases & SQL

Spec & Goals 3 min

AQA Spec 3.7.1 — The concept of a database; the flat-file problem; data redundancy

By the end of this lesson you can:

  1. Define a database and a flat file.
  2. Explain the problems of data redundancy and inconsistency.
  3. State why a relational database is usually a better solution.

Warm-Up 5 min

Unit 6 ended with protecting data. But how is data organised in the first place? Almost every app — a school register, a kedai till, a library — is built on a database.

Quick starter

A library keeps one big spreadsheet. Every time Aisyah borrows a book, her full name, form and address are typed again. What could go wrong?

Reveal the idea

Her details are repeated on every row (wasteful) and might be typed differently each time (inconsistent). That's the flat-file problem.

Key Concept — storing data well 14 min

A database is an organised, persistent collection of data, stored so it can be searched, updated and retrieved easily.

A flat-file database

A flat file stores everything in a single table. It is simple, but repeats data. Here a library keeps loans in one table:

MemberFormTownBookDue
Aisyah10AIpohHatching Twitter12 Jun
Aisyah10AIpohSapiens14 Jun
Wei Jie10BPenangDune13 Jun

Two problems this causes

ProblemWhat it means
Data redundancyThe same data is stored more than once (Aisyah's form and town repeat on every loan).
Data inconsistencyRepeated copies can disagree — one row says "Ipoh", another "ipoh" or "Ipoh". Update one and miss the rest.

Worked Example — spot the redundancy 12 min

Problem: A canteen records every sale in one flat file. Identify the redundancy and the risk it creates.

StudentClassItemPrice (RM)
Priya10ANasi lemak3.50
Priya10AMilo2.00
Priya10ANasi lemak3.50
  • Redundancy: Priya's class ("10A") is stored on every row; the price of "Nasi lemak" is repeated.
  • Risk: if Priya changes class, you must edit every row — miss one and the data is inconsistent. If the nasi lemak price rises, the same problem occurs.
  • Better: a relational design — a Student table and a Product table — each fact stored once, linked by keys.

Try It Yourself 12 min

🟢 Easy

Goal: Define database and flat file.

🟡 Medium

Goal: Explain the difference between data redundancy and data inconsistency.

🔴 Stretch

Goal: A sports club keeps members and their bookings in one flat file. Give two examples of redundancy and the problem each causes.

📝 Exam Practice 10 min

Define[1 mark]

Define the term data redundancy.

Mark scheme
  • Unnecessarily storing the same data in more than one place (1).
Explain[2 marks]

Explain how storing data in a flat file can lead to inconsistent data.

Mark scheme
  • The same data is repeated on many rows (redundancy) (1).
  • If one copy is updated and others are not, the copies disagree / become inconsistent (1).
State[1 mark]

State one advantage of a relational database over a flat-file database.

Mark scheme
  • Reduces data redundancy / reduces inconsistency / data stored once / easier to update (any one) (1).

Recap & Key Terms 3 min

A database organises data for easy search and update. A flat file uses one table and repeats data, causing redundancy (data stored more than once) and inconsistency (copies that disagree). A relational database fixes this by storing each fact once across linked tables.

Database
An organised, persistent collection of data that can be searched and updated.
Flat-file database
A database holding all data in a single table.
Data redundancy
Unnecessarily storing the same data in more than one place.
Data inconsistency
When repeated copies of data do not match each other.

Homework 1 min

Task (≤ 15 min): Take a flat file of doctor's appointments (patient name, address, doctor, room, time). Identify two pieces of redundant data and explain the inconsistency risk each creates.

Model answer (example)

The patient's address repeats on every appointment — if they move, all rows must be updated or the data becomes inconsistent. The doctor's room repeats — if the doctor changes room, every appointment row must change, risking mismatched values. A relational design (Patient table, Doctor table, Appointment table) stores each fact once.

Award marks for: two redundant items identified (2); a valid inconsistency risk for each (2).