SQL Quest › SQL Interview Questions › Aggregation & Grouping
Month-over-Month Customer Growth
The marketing team wants a monthly signup momentum report. For each signup_year and signup_month with new customers, show new_signups (COUNT of customers that month), previous_month_signups (last month's count within the same year), difference (this month minus last), and mom_growth_pct (percentage change rounded to 2 decimals). Partition by year so January always resets (LAG returns NULL — that's intentional, not a bug — it's how you say "compare me within my own year only"). Sort by signup_year, then signup_month.
The analytical pattern here is identical to any MoM aggregation: sales MoM, active-user MoM, support-ticket MoM — same shape, different column.
_Inspired by a thread on MoM analysis by [@FortuneDataGuy](https://x.com/FortuneDataGuy). The real skill isn't calculating MoM — it's interpreting what the number means in context. A 100% MoM jump on a small base (1 → 2) is a different story than a 5% jump on a large base (10,000 → 10,500)._
Solve it in the browser editor →
Runs on SQLite in your browser, graded against the expected result, no signup. A wrong answer gets a diagnosis, not just "incorrect".
Schema
customers
| customer_id | name | signup_date | membership | total_orders | |
|---|---|---|---|---|---|
| 1 | John Smith | john.smith@email.com | 2023-01-15 | Gold | 15 |
| 2 | Emma Wilson | emma.wilson@email.com | 2023-03-20 | Silver | 8 |
| 3 | Michael Brown | michael.brown@email.com | 2023-02-10 | Gold | 12 |
Expected output: ~15 rows — one per (year, month), with Jan of each year showing NULL for previous_month_signups
Hint
Concepts
SELECT GROUP BY Aggregation Window Functions LAG Date Functions
Practise the topic: SQL practice questions · GROUP BY exercises · Window function practice · Date function practice
In these company practice sets
Airbnb · Anthropic · Apple · Databricks · OpenAI · Plaid · Ramp · Revolut · Stripe · Uber · Wise · DoorDash · TikTok
A SQL Quest challenge matched to patterns reported for these companies — not a question any of them has published.
Related questions
Where would this cost you points in an interview?
Ten questions, no signup: a Skillmap across nine SQL skills and the one to fix first.
Take the readiness test