Micro Free Course — 100% Free Learning

All lessons in this module are free to learn. Sign in with Google to save your progress.

0

Business SQL Patterns

The six business-context SQL patterns DA interviews hit hardest: LTV, cohort retention, funnels, growth rates, top-N per group, and anomaly detection. Every one is a query you'll write hundreds of times.

Module Progress0% Complete
130 min total
12 Lessons
0 Completed

Module Content

Calculating LTV in SQL — Patterns from Real SaaS

Three flavours of LTV you'll be asked to compute, and the SQL that gets each one right. FIND_VIDEO: search 'customer lifetime value SQL tutorial' — recommended channel: Data with Danny. Aim for 11 min or under.

11 minVideo
Start

Recap — LTV Three Ways

Historic LTV, predictive LTV, and cohort LTV — same idea, three different SQL queries.

10 minTutorial
Start

Cohort Retention Analysis in Pure SQL

Building the retention triangle from raw events — one query, no Python. FIND_VIDEO: search 'cohort retention SQL window functions' — recommended channel: EverSQL / Mode Analytics. Aim for 12 min or under.

12 minVideo
Start

Recap — Building a Retention Table

The retention triangle is one CTE chain. Once you've written it, you've written it forever.

12 minTutorial
Start

Funnel Analysis with Self-Joins and Window Functions

Two ways to write a funnel — self-joins (simple, slow) and window functions (fast, scalable). FIND_VIDEO: search 'SQL funnel analysis conversion' — recommended channel: Mode Analytics. Aim for 12 min or under.

12 minVideo
Start

Recap — Funnel SQL Patterns

The most-asked product analytics interview question, with both query patterns and when to use which.

10 minTutorial
Start

MoM, YoY, WoW — The SQL Patterns

Every BI dashboard has these. LAG() is your friend. Self-joins are not. FIND_VIDEO: search 'SQL month over month growth LAG' — recommended channel: EverSQL. Aim for 10 min or under.

10 minVideo
Start

Recap — Running Totals and Growth Rates

The growth-rate patterns every BI dashboard uses, written with LAG and SUM OVER.

10 minTutorial
Start

Top-N per Group — The RANK / ROW_NUMBER Trap

The single most-asked SQL interview question — with the three subtle wrong-answer traps. FIND_VIDEO: search 'SQL top N per group ROW_NUMBER RANK' — recommended channel: LearnSQL. Aim for 10 min or under.

10 minVideo
Start

Recap — Top-N Without Falling Into the Trap

ROW_NUMBER, RANK, DENSE_RANK. Same query shape, three different answers. The interviewer is testing whether you know which.

10 minTutorial
Start

Anomaly Detection in SQL — Z-Scores and IQR

Flag the day that doesn't belong, in one query, no Python. FIND_VIDEO: search 'SQL anomaly detection z-score window' — recommended channel: Modern SQL. Aim for 11 min or under.

11 minVideo
Start

Recap — Flagging Outliers

Two flavours of in-SQL anomaly detection — z-scores for normal-ish data, IQR for skewed data.

10 minTutorial
Start
Business SQL Patterns | SQL Interview & Case Lab | Topfolio