SQL: SELECT, FROM, WHERE and ORDER BY – OCR A Level Computer Science lesson (H446)
Students learn to write and interpret SQL queries using SELECT, FROM, WHERE (with AND, OR) and ORDER BY on one table.
Lesson 1 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 ask a database for exactly the records we want?
By the end, students can write and interpret SQL queries using SELECT, FROM, WHERE (with AND, OR) and ORDER BY on one table.
- The Build (the main task)
- Write SQL queries on Saltmere Ferries' Sailing table to list every Isle of Brack sailing on 14 June with fewer than 10 car spaces left, earliest first, and explain what each clause does (6 marks).
- Support version
- Part-filled queries with the clauses in place and gaps for the field names, table name and condition, plus a printed copy of the Sailing table to check the result by hand.
- Challenge
- Write one query that lists the sailings on either route that are full for cars or leave before 07:00, and explain why brackets are needed when AND and OR are mixed.
- Real-world link
- Students meet Saltmere Ferries, a fictional ferry company sailing from Saltmere harbour to two islands, whose booking database is the unit's running context.
- Key words
- SQL, Query and Retrieve, each with a definition, an icon and a common mix-up on the key vocabulary slide.
- Misconceptions it tackles
- “FROM names the database, so the query starts SELECT … FROM SaltmereFerries”; “Text and dates in a WHERE condition need no quotation marks, and a condition is written with ==”.
- 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 allStudents learn to write SQL that joins two tables on a foreign key and filters records with LIKE and wildcards.
Students learn to write INSERT INTO, UPDATE, DELETE and DROP statements and predict exactly which records each one changes.
Students learn to explain referential integrity and how a database enforces it on insert, update and delete, including cascading.
Written for the specifications named. Not endorsed by or affiliated with any exam board.