SQLQuokka
Start practicing
QuestionsLearnSandboxFeaturesRoadmapFAQ

Amazon: Monthly Cohort Retention

Unsolved

Amazon Customer Analytics groups buyers into monthly acquisition cohorts to monitor long-term retention. Write a SQL query to track customer cohorts defined by the calendar month of their very first purchase (`cohort_month` in 'YYYY-MM' format). For each cohort, report: 1. `cohort_month`: Calendar month of the cohort's first purchase. 2. `cohort_size`: Number of distinct customers in the cohort. 3. `month_1_retention_rate`: Percentage of the cohort who placed at least one order in the following month (month + 1), rounded to 2 decimals. 4. `month_2_retention_rate`: Percentage of the cohort who placed at least one order two months later (month + 2), rounded to 2 decimals. Order the results chronologically by `cohort_month` ascending.

SQL Query Editor (Ctrl+Enter to run)
0 characters · Valid
Canonical Solution Official

Official Solution is Hidden

Try solving the question with the schema explorer and hints first. When ready, reveal the verified canonical query and step-by-step logic breakdown.

Community Q&A & Discussion

Ask questions, share alternate queries, and explore solutions

0 comments
Asked By:
🏢 Amazon

Submission History

Your recent query executions and answer checks

Execution Pipeline:
FROM orders
Full source dataset
14 rows total
Ready. Type a query to see live execution.
Clause: Auto-Sync · AlaSQL Engine