Databases · 5 question types
Past paper frequency (2018 to 2024)
This topic accounts for approximately 4% of your exam marks.
SQL SELECT queries and database structure (tables, fields, records) appear as 4 to 6 mark questions.
A WHERE condition often needs to match a pattern in text rather than an exact value. SQL uses the LIKE keyword with the % wildcard, which stands for "any sequence of characters" (including no characters at all).
| Pattern | Meaning |
|---|---|
'J%' | Starts with "J" (e.g. "John", "Jane", "Jake") |
'%son' | Ends with "son" (e.g. "Johnson", "Wilson") |
'%ar%' | Contains "ar" anywhere (e.g. "Mary", "Carter", "Bar") |
'_' | Underscore matches exactly one character (e.g. 'M_n' matches "Man" or "Min") |
SELECT Name, Country
FROM Customers
WHERE Country LIKE 'C%';
For the table from section 6, this returns:
| Name | Country |
|---|---|
| Maya Hassan | Canada |
The other three records (Ireland, Japan, India) are excluded because their country names do not start with C.
SELECT Name
FROM Customers
WHERE Name LIKE '%as%';
Returns Maya Hassan. The % on both sides means "as" can appear anywhere in the name.