EduFlow
Data Science

SQL for Analysts

Answer real business questions with SQL you can defend line by line.

  • 4.7 (940 ratings)
  • 8,100 learners
  • Intermediate
  • 4h 30m total
  • Updated June 2026

Created by Liam Patel

What you’ll learn

  • Filter, sort and bucket data with WHERE, CASE and NULL-safe logic
  • Aggregate at the right grain and join tables without double counting
  • Find what is missing with anti-joins and walk hierarchies with CTEs
  • Rank, compare and accumulate rows with window functions
  • Build funnels, monthly cohorts and retention tables from raw events
  • Check data quality, read query plans and write SQL others can review

Who it’s for

Most SQL courses teach syntax. This one teaches you to answer questions. You join the data team at Cartwheel, an online store selling in eight countries, and work through a queue of requests from its CEO, marketing, operations and finance leads. Every query runs in your browser against a real SQLite database with two years of orders, customers, returns, support tickets and web sessions.

You start with filtering, NULL logic and dates, then learn to aggregate and join without double counting, which is where most analyst mistakes hide. From there you move to CTEs, window functions, funnels and cohort retention, and finish with the habits that make results trustworthy: data-quality checks, query plans, readable style and the differences you will hit in PostgreSQL.

Who it’s for
Analysts, career switchers and developers who know basic SELECT and want to answer business questions with SQL confidently.
Before you start
Basic spreadsheet skills and a first look at SELECT and FROM; no programming experience needed.

Hands-on practice

  • Run real SQL against the Cartwheel store database, in your browser.

Course content

4 sections · 16 lessons · 4h 30m total

  • Questions Before Queries12 min
  • Filtering and Sorting with Purpose16 min
  • NULL Logic and CASE Expressions18 min
  • Working with Dates in SQLite18 min
  • Section checkpoint5 questions

  • GROUP BY, HAVING and the Grain of a Result17 min
  • Inner and Left Joins17 min
  • Fan-Out: When Joins Double-Count17 min
  • Self-Joins and Anti-Joins18 min
  • Section checkpoint5 questions

  • Subqueries, CTEs and Recursive CTEs18 min
  • Window Functions for Ranking17 min
  • Running Totals, LAG and Moving Averages18 min
  • Funnels, Cohorts and Retention20 min
  • Section checkpoint5 questions

  • Data-Quality Checks16 min
  • Indexes and Query Plans16 min
  • Readable SQL and Dialect Differences15 min
  • Capstone: The Q4 Business Review17 min
  • Section checkpoint5 questions
Final assessment · 12 questions · pass mark 70%

Your instructor

Liam Patel

Lead Data Scientist · Datawheel

  • 4.7 instructor rating
  • 32,900 learners
  • 3 courses

Liam started as a business analyst who got tired of copying numbers between spreadsheets, so he learned SQL, then Python, then enough statistics to know when a chart is lying. At Datawheel he leads the team that builds forecasting and churn models for retail clients.

What learners say

4.7

940 ratings

  • Hana Kobayashi

    7 months ago

    The fan-out lesson explained why our revenue dashboard ran 30% high: two joins to order_items were double-counting orders. I fixed it the same afternoon.

  • Omar Khalil

    5 months ago

    Window functions always scared me. After the LAG and running-totals lesson I rebuilt our weekly retention report as one readable query with CTEs.

  • Sara Lindqvist

    2 months ago

    Realistic questions and a dataset that behaves like real data, NULLs included. The exercises run on SQLite and the dialect lesson is short, so I still had to look up a few Postgres differences myself.