SQL practice challenges
Every challenge runs against Kestrel Hardware, a sample computer store with customers, products, orders and order items. Read the task here, then solve it in the lab where your query is checked instantly.
Beginner
- SELECT, ORDER BYThe price listA customer asks for the full product price list. Return every product's name and unit_price, cheapest first. If two prod…
- WHERECustomers in LisbonThe Lisbon branch is running a launch event. Return the first_name and last_name of every customer whose city is Lisbon.
- COUNT, WHERERunning lowThe warehouse wants to reorder anything with fewer than 10 units left. Return a single number: how many products have st…
- Date rangesMarch ordersFinance is closing the books for March 2026. Return the order_id and order_date of every order placed in that month, old…
Intermediate
- GROUP BYCustomers per countryMarketing wants to know where customers are. Return each country and its number of customers, largest first. Break ties …
- LEFT JOIN, IS NULLShelf warmersSome products have never been ordered. Return the name of every product that does not appear in order_items at all.
- Multi-table JOIN, SUMRevenue by categoryReturn each category name and its total revenue, highest first. Revenue is quantity × unit_price from order_items (use t…
- JOIN, GROUP BY, LIMITTop five spendersReturn the five customers who spent the most, as full_name (first and last name with a space) and total_spent rounded to…
- Subquery, AVGAverage order valueWhat is the average value of a delivered order? Return one number, rounded to 2 decimals. First work out each order's to…
- strftime, GROUP BYMonthly revenue, 2026Return revenue per month for 2026 as month (format YYYY-MM) and revenue rounded to 2 decimals, in calendar order. Leave …
Stretch
- HAVINGLoyal customersReturn the email and number of orders (order_count) for customers who have placed more than 5 orders of any status. Most…
- Window functionsBest seller in each categoryFor each category, return the category name, the product that sold the most units (product) and its units. Count units f…