SQLite Practice: WHERE, JOIN and GROUP BY Exercises

Learn the queries that answer everyday questions about data. Each exercise gives you a small table to query, so there is nothing to install: filter rows, join two tables, total values and count groups.

Know what a table and a SELECT statement represent. Every starter includes CREATE TABLE and INSERT statements, so you do not need an external database.

What you will practise

Filter and sort rows

Combine WHERE conditions and ORDER BY to list affordable products that are in stock.

Join related tables

Match customers to their orders with JOIN and understand why rows without a match disappear.

Aggregate customer orders

Use GROUP BY and SUM to calculate one total per customer.

Filter grouped results

Count rows per group and use HAVING to keep only the groups that meet a condition.

4 exercises to try

How to use these exercises

Work out the expected rows by hand, then run the query against the starter data. Inspect column names and values. Once it works, add another row and predict how the output changes.

Runtime and progress

The playground uses SQLite, not a PostgreSQL or MySQL server. Database-specific syntax may differ.

Completion is self-reported. There is no automated grading, and progress is saved only on this device.

Browse every practice topic