SQL exercises
Ten questions about the same store. Try your query, open a hint if you need one, and compare your results.
ORDER BY · LIMITFind the most expensive game
Which game is the most expensive, and how much does it cost?
Open exercise ↗SELECT · WHEREYour first SQL query
Which games cost €30 or less? List them from cheapest to most expensive.
Open exercise ↗WHERE · datesFilter orders by month
Which orders were placed in November 2026? Show them in date order.
Open exercise ↗COUNT · AVGCalculate the average price
How many games are in the catalog, and what is their average price?
Open exercise ↗GROUP BY · SUMCount copies sold
Which game IDs have the most copies sold?
Open exercise ↗INNER JOINRead the line items on a receipt
For each order line, which game was sold, on what date, and at what price per copy?
Open exercise ↗LEFT JOIN · NULLFind customers who have never ordered
Which customers have yet to place an order?
Open exercise ↗GROUP BY · revenueCompare monthly revenue
For each month, how much revenue did the store earn, how many copies did it sell, and how many orders did customers place?
Open exercise ↗WITH · AVGCalculate average order value
What is the average order value if you count each order just once?
Open exercise ↗LEFT JOIN · COALESCERank the games by revenue
Rank the games by revenue. Show the number of copies sold and the number of orders for each game, including games with no sales.
Open exercise ↗