IGCSE · Practice questions · SQL: SELECT, FROM, WHERE and ORDER BY

Filter, then sort.

Six original Cambridge-style questions on SQL queries against a single table, with worked solutions.

Original questions All questions on this page are original work, written in the Cambridge IGCSE style. They are not from past papers. They test the same concepts and skills the syllabus rewards.
Keep these straight

Four clauses, one order.

01
Write
[3 marks]

The table GAMES is shown below.

GameIDTitleGenrePriceYearOnline
G01Star RacerRacing25.002021TRUE
G02Castle QuestAdventure40.002019FALSE
G03Puzzle PopPuzzle10.002023TRUE
G04Speed KingsRacing35.002022TRUE
G05Dragon IsleAdventure30.002020FALSE
G06Block TownPuzzle15.002018FALSE

Write an SQL query to display the Title and Price of every Puzzle game.

  • SELECT Title, Price ✓
  • FROM Games ✓
  • WHERE Genre = 'Puzzle'; ✓
02
Trace
[3 marks]

Using the GAMES table above, give the output of this query.

SELECT GameID, Price
FROM Games
WHERE Online = FALSE
ORDER BY Price ASC;
  • Online = FALSE: G02 40.00, G05 30.00, G06 15.00. ✓
  • Sorted by Price, smallest first. ✓
  • G06 15.00; G05 30.00; G02 40.00. ✓
03
Write
[4 marks]

Write an SQL query on the GAMES table to display the Title and Year of every game released before 2021, newest first. Then give its output.

  • SELECT Title, Year FROM Games ✓
  • WHERE Year < 2021 ✓
  • ORDER BY Year DESC; ✓
  • Output: Dragon Isle 2020; Castle Quest 2019; Block Town 2018. ✓
04
Analysis
[3 marks]

A student wants the titles of all Racing games, most expensive first, and writes:

SELECT Title
FROM Games
ORDER BY Price DESC
WHERE Genre = 'Racing';

Identify the error, write the corrected query and give its output.

  • The WHERE clause must come before ORDER BY. ✓
  • SELECT Title FROM Games WHERE Genre = 'Racing' ORDER BY Price DESC; ✓
  • Output: Speed Kings; Star Racer. ✓
05
Write
[4 marks]

Complete the query so that it displays the Title and Genre of every game costing 25.00 or more, in alphabetical order of title.

SELECT ........ , Genre
........ Games
WHERE Price ........ 25
ORDER BY Title ........ ;
  • Title ✓
  • FROM ✓
  • >= ✓
  • ASC (output: Castle Quest Adventure; Dragon Isle Adventure; Speed Kings Racing; Star Racer Racing). ✓
06
Explain
[2 marks]

Explain the purpose of the WHERE and ORDER BY parts of an SQL query.

  • WHERE sets a condition (search criteria) so that only records meeting it are included in the output. ✓
  • ORDER BY sorts the records in the output by a given field, in ascending or descending order. ✓

Mark this once you have attempted all six and checked your working. It records a Practiced badge on the topic and adds a one-time bonus. Revealing the solutions alone does not count.