/en-tutor-prep-s5-term1-ict-database-design-sql/
/en-tutor-prep-s5-term1-ict-database-design-sql/
General Inquiry: info@TutorZone.com.hk
Office Hours: Monday to Saturday - 9:00 AM to 6:00 PM
WhatsApp Monday to Sunday - 24 hours
Hotline: +852 6828 1809
Instant Support: +852 9061 3106

S5 Term 1 | ICT: Database Design and SQL – Keys, Normalisation and Queries | Tutor Lesson Plan | 45-minute flow, teaching script, common errors, practice with answers

S5 Term 1 | ICT: Database Design and SQL – Keys, Normalisation and Queries | Tutor Lesson Plan | 45-minute flow, teaching script, common errors, practice with answers

  • 2026-12-05

Lesson prep guide · S5 Term 1 ICT

Students can write SELECT but cannot say why a table should be split, and they treat a candidate key as a second primary key. This lesson starts from what is wrong with one wide table, moves to three query patterns, and ends with page counts and index comparisons.

Lesson objectives Students can (1) explain that a primary key is one of the candidate keys and the rest are alternate keys; (2) show that two phone numbers in one cell breaks first normal form and split it into a separate table; (3) split 400 students and 1,200 club rows into Students and Clubs, cutting 216,000 bytes to 120,000, a saving of 44.4 per cent; (4) write WHERE, ORDER BY, GROUP BY and HAVING clauses.

01 Prior knowledge check (first 3 minutes)

If any item below fails, fix it first, or this lesson stalls:

Skill Quick check Pass standard
Percentage 96,000 out of 216,000 44.4 per cent
Rounding up 640,000 divided by 4,096 156.25, so 157 pages
Averages AVG against SUM AVG divides by the count, SUM only adds
Conditions WHERE against HAVING WHERE filters rows, HAVING filters aggregates

02 Lesson flow (45 minutes)

Time Stage Tutor does Student does
0–5 min Diagnostic Draws a five-column table and asks what is wrong Most say it looks messy
5–17 min Keys and 1NF Candidate key, primary key, alternate key, atomic values Spots the two-value phone cell
17–29 min Splitting, 2NF and 3NF Partial and transitive dependency, then join back by foreign key Writes both tables
29–39 min Four query patterns WHERE, ORDER BY LIMIT, GROUP BY HAVING, COUNT with AND Rewrites each and checks the result
39–43 min Pages and indexes Total size over page size, rounded up; an index turns scans into logarithms Works out pages for 2,000 rows
43–45 min Exit check Collects three answers, noting key, normalisation or clause errors Answers without notes

03 Teaching script (read it aloud)

Act one: keys and first normal form

A candidate key is an attribute, or combination of attributes, that uniquely identifies each row. The primary key is the one chosen from the candidate keys, and the others are alternate keys. A student table might use the student number as primary key and the identity card number as another candidate key. First normal form requires one value per cell: a phone column holding “9123 4567, 9876 5432” breaks 1NF because neither number can be searched or deleted on its own. The fix is a separate Phone(student_id, phone) table keyed on both columns, in a one-to-many relationship.

Most common error: treating a candidate key as a runner-up primary key. A candidate key is a qualification; the primary key is the one already chosen.

Have students name the normal form broken by the phone example and write the two columns of the new table.

Students repeat: candidate keys qualify, the primary key is the chosen one, and each cell holds one value.

Act two: splitting tables, 2NF and 3NF

One wide table holds student_id, name, class, club and joined_year, so 1,200 club rows repeat each name and class three times, and changing a class means changing three rows. That is an update anomaly. Second normal form removes partial dependency: a club depends on the club code, not on the student, so clubs belong in their own table. Third normal form removes transitive dependency: class depends on the student, and the class teacher depends on the class, so the teacher does not belong in the student table. Splitting into Students with 400 rows at 120 bytes and Clubs with 1,200 rows at 60 bytes takes the total from 216,000 bytes to 120,000, a saving of 96,000 bytes or 44.4 per cent.

Most common error: stopping once the tables are split. They must join back through keys, or the database is two disconnected lists.

Have students write both tables and mark the foreign key.

Students repeat: 2NF removes partial dependency, 3NF removes transitive dependency, and the parts join back by foreign key.

Act three: four query patterns and data volume

The first pattern is SELECT with WHERE, ORDER BY and LIMIT: the top three in class 5A is SELECT name, score FROM Scores WHERE class = ‘5A’ ORDER BY score DESC LIMIT 3. The second is GROUP BY with HAVING: to list students whose average is at least 60, group by student_id and name and then filter with HAVING AVG(score) >= 60, which WHERE cannot do. The third is COUNT with AND: of 240 orders, 96 have an amount of at least 500, 150 are paid, and 60 satisfy both, so the answer for both conditions is 60, while at least one condition is 96 plus 150 minus 60, or 186. The fourth is the Cartesian product: two tables without a join condition give every pairing, so 12 times 25 is 300 rows, not 12 plus 25. On volume, 2,000 rows at 320 bytes is 640,000 bytes, which over 4,096 is 156.25, so 157 pages; a scan costs up to 2,000 comparisons while an index costs about 11, since 2 to the 11 is 2,048, which is 181.8 times fewer. Have students write the page answer and explain why it rounds up.

Students repeat: WHERE filters rows and HAVING filters aggregates, products multiply while joins pair, and pages always round up.

04 Question types and steps

Type Example Steps Answer
Keys student number and identity card list candidate keys, then choose one both are candidate keys; the student number is primary
Normalisation two phone numbers in one cell name the broken form and create a one-to-many table breaks 1NF; add a Phone table
Query top three in 5A WHERE, ORDER BY, LIMIT SELECT name, score FROM Scores WHERE class = ‘5A’ ORDER BY score DESC LIMIT 3
Volume 2,000 rows at 320 bytes, 4,096 bytes a page total size over page size, rounded up 157 pages
2,000 records at 320 bytes is 640,000 bytes; at 4,096 bytes a page, 640,000 over 4,096 is 156.25, so 157 pagesOne wide table: student_id, name, class, club and joined_year all togetherstudent_idnameclassclubS01Chan5AchessS02Chan5AbasketballS03Lee5AchessRedundancy:a name three timesUpdate anomaly: changethe class in three rowsStudents (PK student_id)student_id, name, class; 400 rows at 120 BClubs (FK student_id)student_id, club, joined_year; 1,200 rows at 60 B120,000 bytes in totalwas 216,000 bytessaves 96,000 bytes (44.4 per cent)SELECT name, score FROM ScoresWHERE class = ‘5A’ORDER BY score DESC LIMIT 3;WHERE filters, ORDER BY sorts, LIMIT takes threeSELECT name, AVG(score) FROM ScoresGROUP BY student_id, nameHAVING AVG(score) >= 60;GROUP BY first, HAVING filters the aggregateA scan of 2,000 records takes up to 2,000 comparisons; an index takes about 11, since 2 to the 11 is 2,048

Normalisation is not just splitting tables: the parts must join back through keys. Pages round up, so 156.25 pages means 157, and an index turns a linear scan into a logarithmic search.

Sanity check (must teach):First normal form is about one value per cell, not one key per table. 640,000 over 4,096 is 156.25, so the answer is 157 pages, never 156. The Cartesian product is 12 times 25, which is 300, not 37. An index costs about 11 comparisons because 2 to the 11 is 2,048, enough to cover 2,000 rows.

05 Three independent practice questions

Question Answer What to observe
Write the query for the top three students in class 5A by score. SELECT name, score FROM Scores WHERE class = ‘5A’ ORDER BY score DESC LIMIT 3; missing ORDER BY, or putting LIMIT before WHERE
List each student whose average is at least 60. SELECT name, AVG(score) FROM Scores GROUP BY student_id, name HAVING AVG(score) >= 60; filtering an average with WHERE, or omitting GROUP BY
2,000 rows at 320 bytes with 4,096-byte pages: how many pages at least? 640,000 over 4,096 is 156.25, so 157 pages rounding down to 156

06 Common errors and correction lines

Error Student usually writes Tutor says
Candidate key as runner-up “the identity card is the second primary key” Both are candidate keys; only one is chosen as primary.
Two values in one cell two numbers in the phone column One value per cell, so the second number needs its own table.
WHERE on an aggregate WHERE AVG(score) at least 60 An average is an aggregate, so it belongs in HAVING.
Pages rounded down 156 pages given 156.25 pages means page 157 is used, so round up.

07 Homework (paper and question numbers)

08 Exit check (last 3 minutes)

Question Answer Verdict
How do primary and candidate keys relate? Candidate keys qualify; the primary key is the chosen one “second primary key” means act one must be retaught
2,000 rows over 4,096 bytes gives how many pages? 156.25, so 157 pages 156 pages means act three must be retaught
What do WHERE and HAVING filter? WHERE filters rows, HAVING filters aggregates Swapping them means act three must be retaught

09 Tutor FAQ

Which year is this page for?

S5 Term 1 databases; S4 spreadsheets and database basics, and S6 SQL revision, can start here.

Can normalisation and SQL fit in 45 minutes?

Yes: 12 minutes on keys and 1NF, 12 on splitting with 2NF and 3NF, 10 on the four query patterns, 4 on pages and indexes, and 7 for the diagnostic, practice and exit check.

Should JOIN syntax be taught here?

No. This page covers the idea and the Cartesian product; ON conditions and LEFT JOIN belong to another page.

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.

Take this guide with you

Reading the full guide is free. Downloading the print version, printing it for students, or taking a whole-level pack needs a tutor account (free).

Registered tutors also get:

Register as a tutor — freeAlready registered? Log in

Join as a tutor or coach — academic, music, sports, arts, STEM. Free to register. See how it works →