Six original Cambridge-style questions on SUM, COUNT, AND and OR 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 find the total price of all the games that can be played online, and give its output.
Write an SQL query on the GAMES table to count the games released after 2019 that cost less than 35.00. Give its output.
Give the output of this query on the GAMES table.
SELECT Title, Price FROM Games WHERE Genre = 'Racing' OR Genre = 'Puzzle' ORDER BY Price DESC;
Give the output of each query on the GAMES table and explain why they differ.
SELECT COUNT(GameID) FROM Games WHERE Genre = 'Adventure' AND Year < 2020; SELECT COUNT(GameID) FROM Games WHERE Genre = 'Adventure' OR Year < 2020;
A student wants the total price of every game in the GAMES table and writes SELECT COUNT(Price) FROM Games; Give the output of this query and correct it.
Explain the difference between SUM and COUNT in SQL.
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.