← Learn
Learn · SQL

Advanced SQL

Eleven lessons on the SQL that data jobs and interviews ask for: window functions, running totals, LAG and LEAD, the top N in each group, removing duplicates, UNION and EXCEPT, self joins and recursive queries, streaks, changing data in transactions, designing tables, making queries fast, and a lesson of mixed problems.

Part of the Data analyst (SQL) path.

Take first: SQL from zero, Combining and summarizing.

More info

How it works

Each lesson is a short read with real queries and what they return, then practice questions. Most have you write a query: it runs as you type on a small shop database in your browser (SQLite), shows what it returns, and is marked right as soon as it returns the same rows as the answer. Any query that gets there counts, so there’s more than one right way. Some questions practise one idea and ask you to use it, like a JOIN or a window function. You can try again as often as you like; “Show the result to aim for” shows the rows you’re after, and after two misses there’s a button to show a query that works.

What do I need to know first?

Combining and summarizing, or being at home with joins, GROUP BY, subqueries and CTEs. The first lesson recaps them.

The other AI and data engineering courses

Where is my progress saved? In this browser, like the rest of the site. Nothing to sign up for.