ITPEC FE Morning April 2021 Question 27
ITPEC FE Morning April 2021 — Question 27 of 80
SQL LIKE Pattern Matching — select rows where a column starts with a specific character.
The task: find all students whose name starts with A.
LIKE wildcards:
- % — matches zero or more characters
- _ — matches exactly one character
Pattern analysis:
- 'A%' → starts with A, followed by anything → correct
- '%A' → ends with A
- '%A_' → has A as the second-to-last character
- 'A_' → starts with A + exactly one more character (2-char names only)
Why not others:
- (a) `'%A'` — matches names ending in A, not starting
- (b) `'%A_'` — matches names with A before the last character
- (c) `'A_'` — too restrictive, only 2-character names like "Al"
Key rule: % = any length, _ = exactly one character. To match "starts with X", use 'X%'.
AI-generated — may contain errors
The original exam layout is preserved in the image so diagrams, formulas, tables, and code remain accurate.
This question comes from an official ITPEC past paper. ITPEC Practice is an independent study tool and is not affiliated with ITPEC. See the official FE past-paper collection or Report an issue.