Single lesson · Written for AQA GCSE Computer Science (8525)

SQL: querying two tables – AQA GCSE Computer Science lesson (8525)

Pupils learn to write SQL queries that retrieve data from two linked tables.

Also in a bundle Software, Translators and Databases – AQA GCSE Computer Science lessons (8525) 14 lessons for £39 · save 30% on buying separately

Lesson 8 of 14 in unit 11.2 Software, Translators and Databases, taught in Year 11, Autumn 2. It answers one big question: How do we answer a question that needs two tables?

By the end, pupils can write SQL queries that retrieve data from two linked tables.

The Build (the main task)
Write an SQL query to return the pet's name and the owner's surname for every pet whose owner lives in Northgate, in alphabetical order of surname (6 marks).
Support version
The two tables with their keys shaded and a query frame with one clause on each line.
Challenge
Write an SQL query to return the name and species of every pet owned by someone with the surname Patel, heaviest first. (6 marks) Rewrite your Build query using INNER JOIN … ON instead of the join in the WHERE clause. (6 marks) Write an SQL query to return the surname and phone number of the owner of every dog weighing over 20 kg, heaviest dog first. (6 marks)
Real-world link
A list of Northgate's pets and their owners for a vaccination reminder.
Key words
Foreign key, Query and Link, each with a definition, an icon and a common mix-up on the key vocabulary slide.
Misconceptions it tackles
“Listing two tables in FROM is enough to link them”; “Field names are written with the field first: OwnerID.Owner”.
AQA 8525 specification
3.7.2 (SQL: SELECT, FROM, WHERE, ORDER BY, INSERT, UPDATE, DELETE).

Every lesson follows the same Code & Commerce structure: a Bell Task recall starter, key vocabulary with definitions and icons, short teaching chunks with a check before pupils move on, The Build (one main task), challenge questions that get harder, and an exit question. Answers reveal one at a time on the slides, and everything is editable PowerPoint and Word.

Also sold in the Software, Translators and Databases unit bundle, which includes the medium term plan, and in the full-year and complete-course bundles.

An independent resource written for AQA GCSE Computer Science (8525). It is not endorsed by AQA.

What's included

  • Slide deck (PowerPoint)
  • Lesson plan (Word)
  • Worksheet (Word)
  • Support worksheet with scaffolds (Word)
  • Single-teacher licence: use and adapt it with your own classes

More for GCSE Computer Science (AQA)

See all

Written for the specifications named. Not endorsed by or affiliated with any exam board.