Six original Cambridge-style questions on SQL queries against a single table, with worked solutions.
The table GAMES is shown below.
| GameID | Title | Genre | Price | Year | Online |
|---|---|---|---|---|---|
| G01 | Star Racer | Racing | 25.00 | 2021 | TRUE |
| G02 | Castle Quest | Adventure | 40.00 | 2019 | FALSE |
| G03 | Puzzle Pop | Puzzle | 10.00 | 2023 | TRUE |
| G04 | Speed Kings | Racing | 35.00 | 2022 | TRUE |
| G05 | Dragon Isle | Adventure | 30.00 | 2020 | FALSE |
| G06 | Block Town | Puzzle | 15.00 | 2018 | FALSE |
Write an SQL query to display the Title and Price of every Puzzle game.
Using the GAMES table above, give the output of this query.
SELECT GameID, Price FROM Games WHERE Online = FALSE ORDER BY Price ASC;
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.
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.
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 ........ ;
Explain the purpose of the WHERE and ORDER BY parts of an SQL query.
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.