Cohort First-Week Return Rate
Problem
**[Classic — cohort analytics]**
Group customers by their **signup week** (first order). For each cohort, calculate:
- `cohort_size`: customers in the cohort
- `returned_count`: customers who placed another order within 7 days
- `return_rate`: % returned
Return `cohort_week` (YYYY-WW), `cohort_size`, `returned_count`, `return_rate`
(rounded to 2 dp), ordered by cohort_week.
Tables
Example rows — the live problem includes the full dataset.
| order_id | customer_id | order_date |
|---|
Expected output
Your answer should return 3 rows with the columns cohort_week, cohort_size, returned_count, return_rate.
Starter code (SQL)
SELECT *
FROM orders;Solve this SQL question free
Write SQL and run it instantly in your browser — even on your phone. No signup needed to try.
Solution & explanation
Create a free account to unlock the optimal solution, a step-by-step explanation, and the hidden test cases that grade your answer.
Sign up free to unlock