Pattern matching with LIKE, % and _
LIKE matches text by pattern in a WHERE clause. % stands for any run of characters and _ for exactly one, so 'S%' finds values starting with S and '%son' finds values ending in son.
Understanding Pattern matching with LIKE, % and _ in ACARA Digital Technologies Years 9–10
What it does: The % at the start allows anything before 'son', so only values finishing with 'son' match. Each _ stands for exactly one character, so 'L__' matches an L followed by two more characters, such as Leo. The S comes first, then % allows any run of characters after it. '%S' would find names that END in S. = looks for the exact text L%, so it finds nothing. LIKE is needed for % to work as a wildcard. A % on both sides of 'at' lets any characters come before and after it, so 'at' can appear anywhere in the value.
Common mistakes: SQL LIKE uses % for any run of characters, not *. With 'S*' the * is just a star character, so no names match. It should be 'S%'. 'son%' finds names that START with son. To find names that END in son, put the % first: '%son'.
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 459–475) and word search (Modules 459–534).
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
WHERE lastName LIKE 'S%'Fill in the Blanks
Spot the Error
Student with a class code? Join your class →