Window functions without fear
Ranking and LAG explained with small examples before the real queries. I am no longer scared of OVER.
Browse
Learn SQL on PostgreSQL with realistic sales data: filtering, joins, aggregation, dates, subqueries, CTEs and your first window functions
Created by Aiko Tanaka
SQL is the most useful skill an analyst can learn, and it ages well: the queries you write today will still work in ten years. This course takes you from your first SELECT to window functions using a realistic dataset from a small online business, with customers, orders, products, refunds and the messy edges real data always has.
Every lesson starts with a question someone at work might ask. Which products sold best last quarter? How many customers came back for a second purchase? What share of revenue came from each region? We answer it with SQL, then check the answer, because a query that runs is not the same as a query that is right.
We use PostgreSQL, free and widely used, with a ready made database you load in one command. Everything you learn transfers to MySQL, SQL Server, BigQuery, Snowflake and DuckDB, and I point out the small syntax differences as they come up.
Analytics lead teaching SQL that answers business questions, from first SELECT to window functions
I have spent most of my career turning vague questions into queries: which customers came back, where the funnel leaks, why revenue looks different in two reports. SQL is the tool I reach for first, and I teach it the way analysts actually use it.
My courses use realistic datasets with messy edges: duplicates, missing values, time zones and late data. You will learn to check your own results, explain a query to a colleague and keep cloud warehouse costs under control.
I write every exercise so it runs on free tools, PostgreSQL, DuckDB or the BigQuery sandbox, so you never need a company account to practise.
Ranking and LAG explained with small examples before the real queries. I am no longer scared of OVER.
I had a filter silently dropping rows with NULL. After lesson two I found it in a report my manager uses weekly.
I only used Excel before. The questions in each lesson felt like my real work, and I now pull my own numbers.
Good for beginners. The cohort lesson was hard but rewarding, and I reused it at work the next day.
Accurate, calm and practical. The comments with assumptions habit has made my queries much easier to share.
The lesson on joins multiplying rows explained why our revenue numbers never matched. A few more exercises would be nice.
The routine for checking your own results is something I now do on every query.
The lessons are great, but getting PostgreSQL running on my work laptop took longer than expected.
I took this to stop waiting for the data team. Dates and time zones section was especially practical.