/en-tutor-prep-s4-term2-ict-query/
/en-tutor-prep-s4-term2-ict-query/
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

S4 Term 2 | ICT: Query Design – Tutor Lesson Plan | 45-minute flow, teaching script, common errors, practice with answers

S4 Term 2 | ICT: Query Design – Tutor Lesson Plan | 45-minute flow, teaching script, common errors, practice with answers

  • 2026-12-01

Lesson prep guide · S4 Term 2 ICT

Students submit a query without counting its rows, so writing OR for AND goes unnoticed. This lesson uses eight loan records to show three criteria giving two, four and seven rows, and makes the row count the check.

Lesson objectives Students can (1) choose the right operator (equals, not equal, range, LIKE) and write a runnable criterion; (2) explain that AND binds before OR and predict the row count; (3) verify a result against the total, the mean and the group subtotals.

01 Prior knowledge check (first 3 minutes)

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

Skill Quick check Pass standard
Reading a table How many of the 8 records are in 3A Three
Comparing Which values meet 4 or more Five and four both do
Totals 40 books over 8 records A mean of 5.0

02 Lesson flow (45 minutes)

Time Stage Tutor does Student does
0–6 min Opening: a query handed in unchecked Show a query with no row check and ask how to tell Suggest one check
6–18 min Four kinds of operator Equals, not equal, BETWEEN 3 and 5, and LIKE prefixes Write one of each and report the rows
18–28 min AND against OR 3A and 4 or more gives two rows, 3A or 4 or more gives seven Predict before running
28–37 min Sorting Descending starts 9, 7, 6 Sort once themselves
37–42 min Verifying with totals 40 books, mean 5.0, fines 37, groups 11, 13, 16 Add the subtotals
42–45 min Exit check Collect three answers and sort operator, order and check errors Work without notes

03 Teaching script (read it aloud)

Act one: a criterion must be runnable

The first step is to state the question, not the syntax. Four operators cover most work: equals, as in class 3A; not equal, which returns 5 rows here; a range, using BETWEEN 3 AND 5 for 4 rows; and a prefix match such as StudentID LIKE S0, which returns all 8. Each must come with a predicted row count. Text needs quotes and numbers do not, and dates need a standard format, or a correct-looking criterion quietly returns nothing. Check the row count first, then the content.

Students restate: text takes quotes and numbers do not, and the row count is checked first.

Act two: AND binds before OR

AND and OR are not equal: AND is evaluated first. Class equals 3A AND Books at least 4 filters the three 3A rows and then the book test, leaving S01 and S04, two rows. Writing OR instead admits all three 3A rows plus every other class with four or more books, seven rows in all, so one word changes two into seven. Mixed logic needs brackets, as in 3A and either four or more books or a fine.

Most common misconception: that AND and OR are read left to right. AND always binds first, so brackets are a tool for changing the result, not decoration.

Students restate: AND binds first, and brackets change the order.

Act three: verify with totals and groups

Every result needs a check. The table holds 8 records, 40 books, a mean of 5.0 and 37 in fines, and grouped by class it gives 11, 13 and 16 books, which add to 40. Sorted descending the counts run 9 down to 2, with a maximum of 9 and a minimum of 2. If the rows, the totals or the subtotals disagree with these figures, the criterion or the join is wrong, not the data, and the habit of checking must become automatic.

Students restate: the subtotals must add to the total, or the criterion is wrong.

04 Question types and steps

Type Example Steps Answer
Equals and not equal Class equals 3A Quotes for text, none for numbers Three rows in 3A and 5 outside
Range Books from 3 to 5 BETWEEN includes both ends 4 rows: S01, S04, S06 and S08
AND and OR 3A and 4 or more books AND binds first, brackets change it Two rows, or 7 with OR
Sorting 8 book counts ORDER BY with DESC and a second key 9 down to 2
Eight loan records, one dataset, three different criteriaIDClassBooksFineS013A50S023A20S033B712S043A40S053B65S063C30S073C920S083C40Class = “3A” AND Books at least 4keeps S01 and S04, two recordsBooks at least 5 OR Fine above 0keeps S01, S03, S05 and S07, four recordsORDER BY Books DESC: 9, 7, 6, 5, 4, 4, 3, 2Totals: 40 books, a mean of 5.0 and 37 in fines; by class 3A 11, 3B 13, 3C 16AND binds before OR: 3A and at least 4 gives two rows, 3A or at least 4 gives seven

One table, three criteria, three answers. The first needs class and book count together, so only S01 and S04 remain; the second keeps any row passing either test, four in all; writing OR instead of AND pulls the whole of 3A in and gives seven. Always count the rows afterwards: eight records, 40 books, a mean of 5.0 and 37 in fines, with class totals of 11, 13 and 16.

Sanity check (must teach):8 records hold 40 books with a mean of 5.0 and 37 in fines. The criterion 3A and four or more returns 2 rows, 3A or four or more returns 7, BETWEEN 3 and 5 returns 4 and not 3A returns 5. Grouped by class the totals are 11, 13 and 16, which add to 40, and sorting runs 9 down to 2.

05 Three independent practice questions

Question Answer What to observe
Write the criterion for class 3A with four or more books and give the row count. Class equals 3A AND Books at least 4, returning 2 rows, S01 and S04 Watch for missing quotes or OR instead of AND
Write the criterion for three to five books inclusive and give the row count. BETWEEN 3 AND 5, returning 4 rows Watch for dropping the inclusive ends
Do the subtotals 11, 13 and 16 agree with the total of 40? They add to 40, so the query is consistent; any gap means a wrong criterion or group Watch whether they actually add the numbers

06 Common errors and correction lines

Error Student usually writes Tutor says
Text without quotes WHERE Class = 3A “3A is text, so it needs quotes; otherwise the system reads a field name.”
AND and OR mixed up Class = “3A” OR Books at least 4 “OR gives seven rows; AND, or brackets, gives the two you want.”
No row check “It ran, so it must be right” “Count the rows, then match 40 and the subtotals 11, 13 and 16.”
Wrong sort direction ORDER BY Books “Highest first needs DESC, or the list runs low to high.”

07 Homework (paper and question numbers)

08 Exit check (last 3 minutes)

Question Answer Verdict
Why do text criteria need quotes? Without them the text is read as a field name Habit means the reason is missing
Which binds first, AND or OR? AND, and brackets change the order Left to right means act two again
How many rows for 3A and four or more, and for 3A or four or more? 2 and 7 Equal numbers mean the distinction is lost

09 Tutor FAQ

Which year is this page for?

S4 Term 2, the database query unit of local secondary ICT; S5 adds subqueries and parameter queries.

Is 45 minutes enough for four operator types?

Yes: twelve minutes on operators, ten on AND and OR, nine on sorting, and the rest on verification and the exit check.

Is there a matching worksheet?

Yes. The homework links to questions 17 and 18 of section E in the S3 ICT paper, where the answer to question 18 is two records.

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 →