SQL for Analysts
From SELECT to window functions. The complete grammar an analyst needs to query, shape, and trust real datasets.
12
Modules
~9h 20m
Reading time
Beginner
Level
Self-paced
Format
Hands-on practice environment
Real SQLite. 50 graded exercises. In your browser.
A live SQLite database seeded with a realistic Kenyan SACCO dataset (1,500 rows across 5 tables). Work through fifty exercises from SELECT to window functions and CTEs — every query you write executes against the same data, instantly.
Syllabus
- 01→
Why SQL, and how a database thinks
The mental model: relations, rows, and why declarative beats imperative for data.
~30 minModule 01 - 02→
SELECT, FROM, WHERE
Pull rows out of a table with filters that match your question, not the other way around.
~40 minModule 02 - 03→
ORDER BY, LIMIT, DISTINCT
Slice, sort, and de-duplicate result sets — the everyday verbs.
~30 minModule 03 - 04→
JOINs: INNER, LEFT, RIGHT, FULL
Combine tables. The single concept that separates beginners from analysts.
~60 minModule 04 - 05→
GROUP BY and aggregate functions
Roll up to summaries — counts, sums, averages, min/max — with HAVING for post-aggregate filters.
~50 minModule 05 - 06→
Subqueries and CTEs
Compose queries from smaller queries. WITH clauses make complex analysis readable.
~50 minModule 06 - 07→
Window functions
Running totals, ranks, lag/lead, percentiles. Where SQL becomes truly analytical.
~60 minModule 07 - 08→
CASE expressions, strings, and dates
Conditional logic, text wrangling, and time arithmetic — the daily tools of cleaning real data.
~45 minModule 08 - 09→
Tables, keys, and a tiny bit of normalization
How to read a schema, why foreign keys matter, and when denormalization is a feature not a bug.
~35 minModule 09 - 10→
Performance: indexes, EXPLAIN, and query smell
Why a query is slow, how to read an execution plan, and the three patterns that fix 80% of issues.
~50 minModule 10 - 11→
Mini-projects on a real dataset
Three guided analyses on a public dataset — cohort retention, revenue trends, and an outlier hunt.
~90 minModule 11 - 12→
Where to go next
Postgres extensions, dbt, BI tools, and the SQL dialects you'll meet at work.
~20 minModule 12
How to use this course
Start with module 01 if the material is new; skip ahead if you have prior exposure. Each module is self-contained but the arc is sequential — the projects in the final module assume the toolkit from modules 1-11. Every module ends with key takeaways and a curated further-reading list with primary sources.