Complete a single-table SQL statement
Assemble the SELECT, FROM, WHERE and ORDER BY parts in the correct sequence.
Exam scope and assessment notes
This sequence follows Cambridge IGCSE Computer Science 0984, 2026–2028 syllabus Version 4, Topic 9. It covers single-table databases only and the specified SELECT, FROM, WHERE, ORDER BY, SUM, COUNT, AND and OR content. The official specimen also demonstrates NOT in a filter. Multi-table joins, GROUP BY, database implementation and the separate 2029–2031 syllabus are not mapped here. Practice is original, self-checked and does not award an official Cambridge grade. Full timed papers and human subject-teacher review remain outstanding. Cambridge states that 0984 has the same 2026–2028 subject content as 0478, with 9–1 grading. In June and November, Cambridge lists 0984 in Administrative zone 3 and for centres in Oman and the UAE. Confirm availability for your centre and exam series with Cambridge International. The separately published 2029–2031 syllabus changes to Python 3 only and removes pseudocode; this 2026–2028 route does not cover those changes.
Before you begin
- Be able to read a small table and compare values. Each lesson introduces the database and SQL terms it uses.
Work on paper. Try each question before revealing help, and explain why your method works.
Quick readiness check
What does SELECT answer?
What you will learn
- Translate a question into selected fields
- Add the correct source table and filter
- Place sorting after filtering
Build the query from the requested output
First identify the output fields for SELECT. Then identify the single source table for FROM.
If the question imposes a condition, add WHERE with the right field and comparison. Use AND or OR according to whether rules are joint or alternative.
Add ordering at the end
If the result must be sorted, finish with ORDER BY Field ASCENDING or DESCENDING.
Read the completed query aloud against the requirement: fields, table, included records, then result order. A semicolon closes the statement in Cambridge examples.
Pause and explain
Which order is valid for selecting Name from PEOPLE where Active is true and sorting by Name?
Worked example
Return titles of Jazz performances that are not sold out, with newest date first.
Show the worked solution
- Select Title and Date if both are needed to interpret the output; otherwise select Title only.
- Filter Type = Jazz and SoldOut = FALSE.
- Sort by Date descending.
Answer SELECT Title FROM PERFORMANCES WHERE Type = "Jazz" AND SoldOut = FALSE ORDER BY Date DESCENDING;
Try a topic test
Choose Easy, Normal or Difficult. Save your answers and open worked review after finishing.
Test this topic →From guided practice to a new situation
Write your answer and reasoning first. Use a hint only if you are stuck. The model solution is for self-checking; your written work is not automatically marked.
Complete a query for EventName from EVENTS where Status = "Open", sorted by EventDate ascending.
Give me a hint
Arrange clauses in the required order.
Compare my reasoning
- Select EventName.
- Name EVENTS as the source.
- Filter Status and add the sort last.
SELECT EventName FROM EVENTS WHERE Status = "Open" ORDER BY EventDate ASCENDING;
Look for these in your work
- Projection
- Filter
- Sort order
A request asks for every score from 2025, highest first. The table is RESULTS with fields Year and Score. Describe each clause.
Give me a hint
Identify projection, source, filter and direction.
Compare my reasoning
- SELECT Score.
- FROM RESULTS WHERE Year = 2025.
- ORDER BY Score DESCENDING.
SELECT Score FROM RESULTS WHERE Year = 2025 ORDER BY Score DESCENDING;
Look for these in your work
- Field
- Filter
- Descending order
A query uses SELECT Title FROM SHOWS ORDER BY Date DESCENDING WHERE Type = "Jazz". Find the structural error and rewrite it.
Give me a hint
WHERE must precede ORDER BY.
Compare my reasoning
- Keep the selected field and table.
- Move the Type condition before the sort.
- End with the descending date order.
SELECT Title FROM SHOWS WHERE Type = "Jazz" ORDER BY Date DESCENDING;
Look for these in your work
- Error identified
- Clause order corrected
Common mistakes
- Putting ORDER BY before WHERE
- Selecting a condition field as output when not requested
- Choosing a sort direction opposite to the request
What can you explain now?
Which clause comes after WHERE when the result must be sorted?
Compare with the explanation
ORDER BY
Ordering follows the filter condition.
After trying it yourself, choose your next review. This is your self-assessment.
Your review choice appears on Today. Sign in to sync it across devices.
Make it stick
What four questions can you ask to assemble a SELECT query?
If you needed the solution, close it and solve the problem again from a blank page. A correct answer is stronger when you can explain the reason for each step.