Testing a query against the data
Predict the rows a query should return from a small sample, run it, then compare the actual result with your prediction. Check row counts, boundary values and JOIN matches.
Understanding Testing a query against the data in VCE Spreadsheets, SQL & Visualisation
What it does: Each result row should combine an order with its matching customer, so you compare the output with the matches you predicted from the sample data. Checking the row count against your prediction shows the query is wrong. Returning some rows does not prove it is correct. Boundary testing checks the exact value at the edge. With >= 50, the row with 50 must appear, and 49 must not. The boundary value 50 is the one that exposes the difference between > and >=. Values far from the boundary behave the same either way. Testing boundary values shows whether >= and > have been used correctly.
Common mistakes: To check a row count you need COUNT(*), which counts rows. SUM(*) is invalid and adds up values instead of counting rows. The boundary value 50 must be included, so the condition needs >= 50. Using > 50 would leave out a student who scored exactly 50, and the test would show a missing row.
Free printable worksheet with full answer key — or add this module to a class and your students practise it interactively.
This module's key terms are also in a printable crossword (Modules 55–70) and word search (Modules 55–86).
Take this worksheet further — free with Cloodit
Each concept is reinforced from every angle — learned, then applied, then tested.
Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.
Over 100 of them, across seven natural biomes.
Turns their work into revision material ready for Flash Cards and Exam study.
Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.
Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.
Quick Questions
Match the Pairs
Key Term
Test a queryFill in the Blanks
Spot the Error
Student with a class code? Join your class →