GCSE · Computer Science · AQA · Spec 8525

What is a relational database

Picture one customer with two different addresses in the same shop's records. Nobody typed it on purpose. Let's see how database designers stop it from ever happening.

Computer Science · Databases

Two tables, one link
Customers tableCustomerIDNameAddress101Sam Lee14 Mill Road102Ben Ortiz9 Park Lane103Sam Lee3 Elm CloseOrders tableOrderIDCustomerIDProduct5001102Headphones5002101Notebook5003102Notebooksame value = linked

Showing 3 layers: Customers table, Orders table, The link

Layers

Explore

Tap each part to find out what it does. Switch the link off and you are left with two separate tables.

The link is not a drawing trick: it is two matching values, one in each table.

Customers on top, Orders underneath. Tap the parts, then try the link layer.

Your turn

What job does this field do?

Sort each field of the Customers and Orders tables by the job it does in its own table.

Still to sort

Primary key (0)

Different on every record of its own table.

Where the line is: A repeated value cannot be the primary key of its table, however useful it is.

Foreign key (0)

Holds primary key values from another table.

Where the line is: It points at records in another table, so its values can come up again and again in this one.

Ordinary field (0)

Just a detail about the record.

Where the line is: Neither identifies the record nor holds another table's key.

5 of 5 still to sort.

Same two tables as above. Pick a field, then drop it where it belongs.

Watch out: CustomerID appears in both tables, but it does not do the same job in both. Ask each table separately: is this value different on every record here, or is it borrowed from another table?

Predict, then check

Now take the same shop and squash it into one big table. Think first.

In one big table, Ben Ortiz's address (9 Park Lane) is typed on both of his orders, 5001 and 5003. Ben moves to 21 Hill Street, and someone updates the address on order 5001 only. What does the database now say Ben's address is?

Your turn to write

Explain it in your own words

A shop stores its customers and its orders in two linked tables rather than in one single table. Explain how this reduces data redundancy and helps avoid data inconsistency. [4 marks]

0 words · your answer stays on this page and is not sent anywhere.

Exam line: Name the benefit and say how it happens: each fact is stored once, so a change is made in one place, so copies cannot disagree.

UK note

AQA GCSE Computer Science (8525): relational databases are in specification section 3.7.1. Computer Science isn't tiered, so this is for everyone.

WHAT YOU'VE LEARNED

A quick recap of today's lesson.

One table per type of thing, joined by keys, so every fact lives in one place.

What you need to know

  • A relational database uses more than one table, each about one type of entity: a customer, say, or an order.
  • Each row of a table is a record, and each column is a field.
  • Tables are linked, or related, through fields they have in common.
  • Have a goA school has a Pupils table (PupilID, Name) and a Clubs table (ClubID, ClubName). As they stand, could these two tables be linked? Say why.

    No. They have no field in common.

    Tables are linked through fields they have in common, and these two share none yet.

  • Primary key: a field whose value uniquely identifies each record in its table, so no two records share one.
  • Have a goYour classmate says: 'Name makes a perfect primary key. Everybody has one!' Then two pupils turn out to be called Sam Lee. What goes wrong?

    Two records would share the same primary key value.

    Having a value isn't enough. A primary key has to be different for every record in its table, and two Sam Lees would clash.

  • Foreign key: a field in one table that holds the primary key value of a record in another table.
  • Matching foreign key values to primary key values is what links records across the two tables.
  • Have a goThree records in a Bookings table each hold the foreign key value 7. How many records in the Members table do they point to?

    One: the Members record whose primary key is 7.

    A primary key value is unique in its own table, so a matching value can only land on one record. Many bookings can share a member.

  • Splitting data into linked tables reduces data redundancy: each fact is stored once, not repeated in many records.
  • Less redundancy helps avoid data inconsistency: change a fact in one place and different copies can't disagree.

The big picture

A relational database stores data in more than one linked table, one for each type of thing. A primary key identifies each record in its table, a foreign key holds another table's primary key values to link the tables, and storing each fact once reduces redundancy and helps avoid inconsistency.

Key points

1One table per type of entity, linked through fields the tables have in common.
2In a link, the primary key identifies each record in its own table and the foreign key holds those values in another table.
3Matching the foreign key value to the primary key value joins the records together.
4Stored once means less data redundancy.
5A change made in one place means different copies cannot disagree, which helps avoid data inconsistency.

Worked example

Problem

Practice question: A vet's surgery stores its data in two linked tables. Owners has the fields OwnerID and OwnerName, with the records (1, Ms Green) and (2, Mr Patel). Pets has the fields PetID, PetName and OwnerID, with the records (31, Biscuit, 2), (32, Mango, 1) and (33, Pip, 2). (a) Which field is the primary key of Pets? (b) Which field in Pets is a foreign key? (c) Who owns Pip?

⚠ Watch out

Thinking the field both tables share is a primary key in both. In a link like this it is the primary key in one table (a different value on every record) and a foreign key in the other (holding those values).

🧠

Memory hook

One table per thing. Keys do the linking. Store it once, change it once.

✓

Check yourself

Cover the page. Invent a Teachers table and a Classes table, two or three records each. Mark each primary key, add a foreign key to Classes, and say which Teachers values it holds.

Flashcards

(8)
What is a relational database?
Data stored in more than one table, each table about one type of entity, with the tables linked through fields they have in common.
What is an entity in a database design?
A type of thing that a table holds data about, for example customers or orders. Each gets its own table.
What does the link between two tables actually consist of?
Matching values: foreign key values in one table matching primary key values in the other.
What is a primary key?
A field whose value uniquely identifies each record in its table, so no two records in that table share the same value.
What is a foreign key?
A field in one table that holds the primary key value of a record in another table.
A Loans table has a MemberID field whose values come from the Members table. Primary key or foreign key in Loans?
Foreign key. It holds primary key values of records in another table.
What is data redundancy?
The same fact being stored over and over in many records. Linked tables store each fact once instead.
What is data inconsistency, and how do linked tables help avoid it?
Different copies of the same data disagreeing. With each fact stored once there is only one place to change it, so copies can't disagree.

Tap any card to flip it, or use Study as deck to go through them one at a time. In the full lesson these run as a spaced-repetition deck — you rate each card Hard, Good or Easy and the tricky ones keep coming back until they stick.

Learning with Lightbulb is opening soon

You can use this lesson now. Join the waitlist and we'll let you know when the full Lightbulb experience is ready.

Keep me posted

More AQA GCSE Computer Science topics

See the full AQA Computer Science curriculum →

How this lesson was checked. This AQA GCSE Computer Science (specification 8525)lesson was published through Lightbulb Learning's human-designed editorial process — the educational standards, accuracy rules and publication checks it must pass were authored and approved by Philip Halpin. It passed subject-specific assessment, automated educational checks and technical publication verification before going live (publication checks completed 4 November 2026). Published pages are monitored, human spot-checking is ongoing across the lesson library, and anything found wrong is corrected or withdrawn. How our lessons are made and checked. Spotted a mistake? Email hello@lightbulblearning.co and we'll review it.