S6 Term 1 | ICT: Databases and SQL Queries (Normalisation, Keys and Indexes) — Tutor Lesson Plan | 45-minute flow, teaching script, common errors, practice with answers
- 2026-12-01
Tutor lesson plan · S6 Term 1 ICT
Database marks sit in two places: the order of SQL clauses, and the reasoning behind the design. Students can write a SELECT but put HAVING before GROUP BY and treat an index as always faster, which costs half the question. This lesson uses one query and one table to fix the order and the cost.
01 Prior knowledge check (first 3 minutes)
If any of these is missing, fix it before the lesson:
| Skill | Quick check | Pass standard |
|---|---|---|
| Primary key | Which column uniquely identifies a student | The student number |
| Basic SQL | How to select only the name column | SELECT name FROM students |
| Logarithms | Two to what power is about one million | About 20 |
02 Lesson flow (45 minutes)
| Time | Stage | Tutor does | Student does |
|---|---|---|---|
| 0-5 min | Diagnose | Ask how WHERE differs from HAVING | Most say both filter, none give the order |
| 5-15 min | Read the paper | 75 minutes over 100 marks, then the three parts | Students get 25.5, 24 and 6.25 minutes |
| 15-25 min | SQL skeleton | Six clauses in order, conditions added one at a time | Students write a query as six lines |
| 25-35 min | Normalisation | One wide table split into three, with keys named | Students find repetitions and name an anomaly |
| 35-42 min | Index cost | Linear against binary on a million rows | Students get 20 and state the write cost |
| 42-45 min | Exit check | Three questions, collect the scripts | Oral answers |
03 Teaching script (read it aloud)
Act one: the paper and the SQL skeleton
The skeleton: “SELECT the columns, FROM the table, WHERE the row condition, GROUP BY the group, HAVING the group condition, ORDER BY the sort. Six positions, never reordered. WHERE filters rows before grouping; HAVING filters groups after.”
One example: “Select class, count of students and average score from students, grouped by class, keeping classes with five or more, ordered by average score descending. That answers how many and how well, class by class, for the large classes only.”
Students repeat: WHERE before grouping, HAVING after, ORDER BY last.
Act two: normalisation is about anomalies, not steps
Three tables: “Students for number and name, subjects for subject, teacher and office, and enrolment for number and subject. From 5 columns to 3 tables, repetition gone, one key each, and enrolment joins the other two with two foreign keys.”
Foreign keys: “Referential integrity means the student number in enrolment must exist in students. Allow it and you get orphan rows that never match in a report.”
Students do: circle the repeated teacher and office in the wide table, then draw three tables and the two links.
Students repeat: normalisation removes update, insert and delete anomalies, and foreign keys keep referential integrity.
Act three: what an index costs
Join cost: “Tables of 100 and 1,000 rows without a join condition give a Cartesian product of 100,000; with the key equality it is the 100 matching rows. A missing join condition is the commonest way a query explodes.”
The cost: “An index speeds reads but every insert, update and delete must maintain it, so writes slow and storage grows. Index the columns you search, not every column.”
Students repeat: an index turns linear into binary but slows writes, and a missing join condition gives a Cartesian product.
04 Question types and steps
| Type | Example | Steps | Answer |
|---|---|---|---|
| SQL query | Students per class with an average score, large classes only | Write the six clauses in order, adding one condition at a time | class, count, average, HAVING count of five or more |
| Normalisation | One wide table of five columns | Find repetition, name an anomaly, split, name keys | Students, subjects and enrolment |
| Indexes and performance | A table of a million rows | Compare linear and binary, state the write cost | 1,000,000 against 20 |
| Data validation | Input field checks | Range, type, presence and format, one example each | Age from 0 to 120, an email with an at sign |
Top: parts of 34, 34 and 32 marks at 45 seconds a mark give 25.5, 25.5 and 24.0 minutes, adding to 75, with 6.25 minutes a question. Bottom left: the five clauses of a SELECT in order. Bottom right: on 1,000,000 rows an unindexed search scans 1,000,000 times, while a binary search takes 20.
05 Three independent practice questions
| Question | Answer | What to observe |
|---|---|---|
| On a million rows with no index, how many comparisons in the worst case? | 1,000,000 | Whether students take the row count as the comparison count |
| With a binary-search index, about how many? | 20 | Whether students use two to the twentieth is about a million |
| Tables of 100 and 1,000 rows with no join condition give how many rows? | 100,000 | Whether students multiply rather than add |
06 Common errors and correction lines
| Error | Student usually writes | Tutor says |
|---|---|---|
| Putting HAVING before GROUP BY | Select the count, then HAVING, then GROUP BY | Groups must exist before you filter them: GROUP BY first, then HAVING. |
| Filtering an aggregate with WHERE | WHERE count of students is more than five | WHERE sees rows, not aggregates; conditions on aggregates belong in HAVING. |
| Assuming every index helps | Index every column and it will be fastest | An index speeds reads but must be maintained on every write, so write-heavy tables get slower. |
| A join with no condition | List both tables in FROM and select | Without the key equality you get a Cartesian product, 100 times 1,000, so 100,000 rows. |
07 Homework (paper and question numbers)
- S6 ICT paper, part B questions 5 to 8 (34 marks): databases and SQL These drill SELECT and normalisation; write queries as six ordered lines
- S6 ICT paper, part A questions 1 to 4 (34 marks): data representation and compression The same data-handling theme with different arithmetic, useful for contrast
- S6 ICT paper, part C questions 9 to 12 (32 marks): networks, security and validation Validation and indexing are both design trade-offs, so answer in trade-off language
08 Exit check (last 3 minutes)
| Question | Answer | Verdict |
|---|---|---|
| Which runs first, WHERE or HAVING? | WHERE, before grouping | Wrong means reteach act one |
| About how many steps does an index need on a million rows? | 20 | Wrong means reteach the logarithm |
| What does a join without a condition produce? | A Cartesian product | Wrong means reteach join conditions |
09 Tutor FAQ
Which year is this for?
S6 Term 1 mainly; S5 students who know basic SQL can use it for integration practice.
Must students memorise full SQL syntax?
Only the six clauses and their keywords; the detail can be looked up, but the split between WHERE and HAVING must be certain.
Is there a paper to go with it?
Yes. The homework section links to the S6 ICT paper, three parts and 12 questions in 75 minutes, with answers and marking points.
Find a tutor freeTutor sign-up →
©2026 TutorZone · www.tutorzone.com.hk · Terms of use · All rights reserved. Original TutorZone material for personal study and teaching only; not for resale or republication.



