S6 ICT: SQL Database Queries, basics
- 2026-11-20
S6 ICT: SQL Database Queries, basics
Start from SELECT and WHERE, then check the output of COUNT, SUM, AVG, MIN, MAX and DISTINCT item by item.
Basics: single table queries and aggregates This paper works from an eight row Student table. It separates COUNT(*) from COUNT on a column, then uses WHERE to filter the four class A rows, four scores above 80 and two class B scores above 60. The aggregate section checks the top score of 91 shared by two students, a total of 549, an average of 78.43, a spread of 36 between lowest and highest, and two distinct classes with DISTINCT. Every item carries an answer and a one line explanation, and each number is computed and asserted in Python.
01 Paper details (check answers afterwards)
| Item | Detail |
|---|---|
| Questions | 10 |
| Suggested time | 25 |
| Difficulty mix | Foundation 3 · Intermediate 3 · Challenge 3 · Error redo 1 |
| Chapter | Chapter: S6 ICT: SQL Database Queries |
| Level | Basics (10 items) |
02 Questions (10 items)
- FoundationThe Student table has 8 rows and one NULL Score. How many rows does SELECT COUNT(*) FROM Student return?
- FoundationHow many rows does SELECT Name FROM Student WHERE Class = ‘A’ return?
- FoundationWhat does SELECT COUNT(*) FROM Student WHERE Score above 80 return?
- IntermediateWhat does SELECT MAX(Score) FROM Student return, and how many students reach it?
- IntermediateWhat does SELECT SUM(Score) FROM Student return, and how is the NULL handled?
- IntermediateWhat does SELECT AVG(Score) FROM Student return, to two decimal places?
- ChallengeHow many values does SELECT DISTINCT Class FROM Student return?
- ChallengeSELECT MIN(Score), MAX(Score) FROM Student returns two values. What is their difference?
- ChallengeWhat does SELECT COUNT(*) FROM Student WHERE Class = ‘B’ AND Score above 60 return?
- Error redoError rework: a student says SELECT COUNT(Score) FROM Student returns 8 rows. What is wrong?
03 Answers and one-line notes
| # | Answer | One-line note |
|---|---|---|
| 1 | It returns 8 rows. | COUNT(*) counts table rows, so a NULL in a column never removes a row from the count. |
| 2 | Four rows: Chan, Lee, Wong and Yip. | WHERE keeps only the rows whose Class equals A, so the other four rows are filtered out. |
| 3 | It returns 4 rows. | The scores that qualify are 82, 91, 88 and 91, which belong to four students. |
| 4 | It returns 91, reached by two students. | MAX returns a single top value, so a second student with the same score needs WHERE Score = 91 to be counted. |
| 5 | It returns 549. | SUM ignores NULL, adding the seven real scores, and the empty row contributes nothing. |
| 6 | It returns 78.43. | AVG divides 549 by 7, the number of real scores, not by the eight rows of the table. |
| 7 | Two values, A and B. | DISTINCT removes repeated class codes, and the eight rows hold only two distinct classes. |
| 8 | The minimum is 55, the maximum 91, so the difference is 36. | Two aggregates run side by side in one SELECT, and subtracting them gives the spread. |
| 9 | It returns 2 rows. | Of the three real scores in class B only 65 and 88 are above 60, while 55 fails the test. |
| 10 | The correct answer is 7 rows. | COUNT on a named column skips NULL, and only COUNT(*) counts every table row. |
04 What to do after marking
- After marking, redo only the wrong items and write down which step went wrong (formula, unit, or misread number).
- Repeat the same item two days later; move to the next paper only when both attempts are correct.
- Parents only need the answer and note columns; there is no need to explain every item.
Want to draw the flowchart and fill the trace table yourself? Book a TutorZone tutor and unpack all ten items in 25 minutes.Tutor Registration →
Questions and answers are written originally by the TutorZone team and are not taken from any school, publisher or examination authority paper. Every value is checked by computer.



