Common mistakes in SQL scripts
A mistake in an SQL script, such as text without quotes, > instead of >=, AND instead of OR, clauses in the wrong order, a missing table after FROM or a missing semicolon.
Understanding Common mistakes in SQL scripts in IGCSE Computer Science Paper 2
What it does: The >= operator includes the boundary value 100, while > would miss students with exactly 100 points. A record only needs to meet one of the two conditions, so OR is correct. AND would return no rows. Text values must be inside quotes. Without quotes, SQL treats Red as a field name and the query fails. A student has only one year level, so AND returns no records. OR is needed when either condition can be true. The order is SELECT, FROM, WHERE, ORDER BY. WHERE must come before ORDER BY. Use > when the boundary value must be excluded. Use >= when it must be included. Check the wording of the requirement carefully.
Common mistakes: The table name is missing after FROM. SQL needs to know which table to read, so it should be FROM students. Text values in a WHERE condition must be inside quotes. It should be WHERE category = 'Tech'.
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 539–551) and word search (Modules 539–580).
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
SQL errorFill in the Blanks
Spot the Error
Student with a class code? Join your class →