Single lesson · Written for OCR A Level (H446)

SQL: joining tables – OCR A Level Computer Science lesson (H446)

Students learn to write SQL that joins two tables on a foreign key and filters records with LIKE and wildcards.

Also in a bundle Databases, SQL and Floating Point – OCR A Level Computer Science lessons (H446) 14 lessons for £45 · save 19% on buying separately

Lesson 2 of 14 in unit 13.1 Databases, SQL and Floating Point, taught in Year 13, Autumn 1. It answers one big question: How do we bring related records from two tables together?

By the end, students can write SQL that joins two tables on a foreign key and filters records with LIKE and wildcards.

The Build (the main task)
Write an SQL query that lists the surname, email and sailing date of every Saltmere Ferries passenger booked on a Brack sailing whose vehicle registration starts SM, joining Passenger and Booking with Sailing (6 marks).
Support version
An entity relationship diagram of the three tables with the key fields highlighted, and a query frame with the JOIN … ON lines started: students fill in the matching key fields and the LIKE pattern.
Challenge
Write a query that counts how many bookings each route has on 14 June, and explain what would happen if the ON condition were left out.
Real-world link
Saltmere's port office wants a list of passengers and vehicles for each sailing, which needs data from two or three tables at once.
Key words
JOIN, Wildcard and Link, each with a definition, an icon and a common mix-up on the key vocabulary slide.
Misconceptions it tackles
“A JOIN works without an ON condition: SQL finds the matching records by itself”; “* is the wildcard in a LIKE pattern, so Email LIKE '*@isles.net' finds the matching emails”.
OCR H446 specification
1.3.2 (d).

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.

Students need computers for the main task.

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

An independent resource written for OCR A Level Computer Science (H446). It is not endorsed by OCR or Cambridge University Press & Assessment. Programming project (NEA) lessons teach general skills on a made-up example project and give supervised time, within JCQ's rules on the help a centre may give.

What's included

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

More for A Level Computer Science

See all

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