Back to SQLGenie

Free SQL Practice — Interactive Exercises

Write real SQL against a practice schema and get instant feedback in your browser. Six exercises, beginner to advanced — no signup, nothing stored, nothing to install.

The practice schema

Every exercise uses the same four tables — a small shop with customers, orders, products and order items:

customers (id, name, email, country, created_at)
orders (id, customer_id, total, status, created_at)
products (id, name, price, category)
order_items (id, order_id, product_id, quantity, unit_price)

Your answers are checked against this schema: wrong table or column names, and JOINs without an ON condition, are caught instantly.

The exercises

1. Beginner

Find customers from one country

Write a query that returns the name and email of every customer from Germany.

2. Beginner

Count completed orders

Write a query that counts how many orders have the status 'completed'.

3. Intermediate

Revenue per customer

Write a query that shows each customer_id and the total amount they have spent, highest spenders first.

4. Intermediate

Orders with customer names

Write a query that lists every order id and total alongside the name of the customer who placed it.

5. Advanced

Big spenders only

Write a query that shows customers (by customer_id) whose total spending across all orders is over 500.

6. Advanced

Products in every order

Write a query that shows each order id together with the product name and quantity for every item in that order.

Frequently asked

Is this SQL practice free?

Yes — every exercise is free, with no account and nothing stored. Your answers are checked right in your browser.

What SQL dialect do the exercises use?

Standard SQL that works in MySQL, PostgreSQL, SQL Server and SQLite. The schema is small on purpose so you can focus on the query logic.

Stuck on an exercise?

Use the hint first. If you're still stuck, paste your attempt into SQLGenie's Fix My SQL mode — it explains what's wrong and rewrites the query for you.

Stuck? Let SQLGenie write or fix it

Describe the query in plain English and SQLGenie generates the SQL — or paste your broken attempt into Fix My SQL for a corrected version with an explanation.