Practise SQL
SQL challenges
25 SQL exercises on real-looking data, from a first WHERE to window functions. Write the query, press Run & check, and see straight away if it's right. Free, in your browser, no sign-up.
Easy 8 challenges
- 1 Customers from Sri Lanka SELECT · WHERE · ORDER BY
- 2 Out-of-stock products SELECT · WHERE
- 3 The most expensive product ORDER BY · LIMIT · subquery
- 4 Count orders by status GROUP BY · COUNT
- 12 Restock empty shelves UPDATE · WHERE
- 14 Salaries in Engineering JOIN · WHERE · ORDER BY
- 15 Employees without a department IS NULL
- 16 The second-highest salary subquery · MAX
Medium 13 challenges
- 5 Customers who never ordered LEFT JOIN · IS NULL · NOT EXISTS
- 6 Customers who ordered more than once JOIN · GROUP BY · HAVING
- 7 Total of each order GROUP BY · SUM · expressions
- 8 Each customer's first order JOIN · GROUP BY · MIN
- 9 Orders per month GROUP BY · date functions
- 10 Revenue per category JOIN · GROUP BY · SUM
- 11 The best customer JOIN · GROUP BY · ORDER BY · LIMIT
- 18 Headcount per department LEFT JOIN · GROUP BY · COUNT
- 19 Employees and their managers self join · LEFT JOIN
- 20 Earns more than their manager self join
- 21 Team size of each manager self join · GROUP BY
- 22 Hires per year GROUP BY · date functions
- 25 Give Support a pay rise UPDATE · subquery