SQL is how you ask a database questions. Grade 11 covers retrieving and filtering data from a single table; Grade 12 adds joins and aggregates.
Every query is built from the same clauses, and they must appear in this order:
| Clause | Purpose | Example |
|---|---|---|
| SELECT | Which fields to show | SELECT FirstName, Surname |
| FROM | Which table | FROM tblLearners |
| WHERE | Which records to include | WHERE Grade = 11 |
| ORDER BY | How to sort the result | ORDER BY Surname ASC |
Example
SELECT FirstName, Surname, Grade FROM tblLearners WHERE Grade = 11 AND Gender = 'F' ORDER BY Surname ASC;
| Operator | Meaning | Example |
|---|---|---|
| = <> < > <= >= | Comparison | WHERE Mark >= 50 |
| AND / OR / NOT | Combine conditions | WHERE Grade = 11 AND Mark > 60 |
| LIKE with % and _ | Pattern match | WHERE Surname LIKE 'B%' |
| BETWEEN … AND | Inclusive range | WHERE Mark BETWEEN 50 AND 74 |
| IN (…) | Any of a list | WHERE Grade IN (10, 11) |
| IS NULL | No value stored | WHERE Email IS NULL |
You can also create a calculated field in the SELECT list and name it with AS. The memo expects the exact name the question asked for.
Example
SELECT Description, Price, Price * 1.15 AS PriceWithVAT FROM tblStock;
💡 Exam Tip
Text literals go in single quotes ('F'); numbers do not. And % matches any number of characters while _ matches exactly one — 'B%' is 'starts with B', '_B%' is 'B is the second letter'.