Single lesson · Written for OCR A Level (H446)

Indexing and secondary keys – OCR A Level Computer Science lesson (H446)

Students learn to explain how an index and a secondary key speed up searches, and what indexing costs.

Also in a bundle Compression, Encryption, Hashing and Databases – OCR A Level Computer Science lessons (H446) 12 lessons for £45 · save 6% on buying separately

Lesson 11 of 12 in unit 12.11 Compression, Encryption, Hashing and Databases, taught in Year 12, Summer 2. It answers one big question: How can a database find one record among millions quickly?

By the end, students can explain how an index and a secondary key speed up searches, and what indexing costs.

The Build (the main task)
Explain how adding an index on the Camera field of Shutterbox's Photo table would affect searches and uploads, and why Camera is a secondary key rather than a primary key (6 marks).
Support version
A small Photo table beside its index on Camera (sorted values with record pointers), and the steps of a search with and without the index to put in order.
Challenge
Discuss whether Shutterbox should index every field of its Photo table (9 marks, levels 7–9 / 4–6 / 1–3).
Real-world link
Shutterbox's search page, where members look for photos by camera, lens or location.
Key words
Database index, Secondary key and Speed, each with a definition, an icon and a common mix-up on the key vocabulary slide.
Misconceptions it tackles
“An index sorts the table itself”; “A secondary key must be unique, like a primary key”.
OCR H446 specification
1.3.2 (a).

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 can do it all on paper.

Also sold in the Compression, Encryption, Hashing and Databases 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)
  • Indexing and secondary keys - Quiz Quiz Trade Cards
  • 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.