The query ran. The number is wrong.

This one is meant to count discounted orders for each of the shop's 40 customers, zeros included. Run it and look at how many rows come back.

SELECT c.name, COUNT(o.id) AS discounted_orders
FROM customers c
LEFT JOIN orders o ON o.customer_id = c.id
WHERE o.discount >= 0.1
GROUP BY c.name
ORDER BY discounted_orders;
namediscounted_orders
Bram Haddad1
Hana Kowalski1
Kofi Reyes1
Leilani Fonseca1
Mirela Dubois1
Noor Lindqvist1

30 rows, first 6 shown

A level means you did it

The tutor can propose that you got something right. It can't raise your level. The server counts your passes, and a query exercise is marked by comparing your actual result with the correct one.

LevelMeaningTo earn it
0Haven't met itWhere most people start on something new
1Heard of itTwo passes at the level below, one from unaided recall. A hint downgrades the pass. Pressing "Just tell me" earns none.
2Can follow along
3Can do it with help
4Can do it alone
5Could teach itThe same, plus an edge case you handled and an explanation someone could learn from

How a session goes

  1. Placement

    About five questions, easy to hard, with no teaching. You get a map of eight skills, from filtering through window functions.

  2. One question at a time

    Get one wrong and the next question is narrower. It's built to contradict what you just said, so you find the error yourself.

  3. Real queries

    Exercises run against a bike shop's database in your browser. It has the NULLs, ties and orphaned rows that break naive queries.

  4. Unannounced review

    Old skills come back with no warning. Fail one and the level drops.

  5. Final assessment

    When every skill reaches level 4, you sit a mixed exam with no hints and one problem that needs several skills at once.

Guides

Questions

Why not ask ChatGPT?
You can, and it will fix your query. That's useful at work and bad for an interview, where nobody is there to fix it. Wrong Join withholds the answer, runs what you write, and keeps a record of what you can do unaided.
Is the tutor an AI?
Yes. It's a large language model, and it can make mistakes. Query results come from a real SQL engine, so whether your query is correct doesn't rest on the model's opinion.
Which SQL does it teach?
Standard SQL, run on SQLite. Joins, aggregation, CTEs and window functions carry straight over to Postgres, MySQL, BigQuery and Snowflake. Date functions differ between engines, and the tutor will say so when it matters.
What does it cost?
Eight tutor turns with no account, twenty a day with one, or $12 a month for Pro. See pricing.