Learn SQL, topic by topic

From your first SELECT to joins, grouping and window functions. Every topic with an explanation, examples and an exercise you play right in your browser.

Start your first lesson

Every lesson takes a few minutes.

See all lessons

Learn SQL your way

Every learner is different. Pick what fits you.

Module 1

First day

Your first client as a freelance data analyst: the Bonen & Co coffee roastery. You learn to read tables and fetch data with SELECT.

Module 2

Second day

Your second client: Rewind, the video store in Mechelen. You learn to find exactly the rows you're looking for with WHERE, comparisons, AND/OR/NOT, IN, BETWEEN, LIKE and NULL.

Module 3

Third day

Your third client: the Zomerklank music festival in Hasselt. You learn to sort results with ORDER BY, on several columns, and to remove duplicates with DISTINCT.

Module 4

Fourth day

Your fourth client: De Trapper bike rental in Bruges. You learn to count, add up and average with COUNT, SUM, AVG, MIN and MAX, and to summarise everything per group with GROUP BY and HAVING.

Module 5

Fifth day

Your fifth client: football club FC De Kraaien in Lier. You learn to combine tables with keys and JOIN: INNER, LEFT, RIGHT and FULL, with aliases, across several tables and even a table with itself.

Module 6

Sixth day

Your sixth client: Het Leeslint library in Kortrijk. You learn to query smarter: reshaping text and dates, choosing with CASE, asking questions inside questions with subqueries and EXISTS, and keeping long queries readable with WITH.

Module 7

Seventh day

Your seventh client: Bloem & Boter, a bakery in Leuven. You learn to change data: add rows with INSERT, change them with UPDATE, remove them with DELETE, and work all-or-nothing with transactions.

Module 8

Eighth day

Your eighth client: the Ronde van het Pajottenland, a five-day stage race. You learn window functions: numbering with ROW_NUMBER, ranking with RANK, per group with PARTITION BY, standings with running totals, and combining lists with UNION.

Everything on one page: the SQL cheat sheet →