Day-1 and Day-7 Cohort Retention
Problem
**[Classic — cohort analytics]**
For each signup cohort (grouped by `signup_date`), calculate:
- `cohort_size`: number of users that signed up
- `day1_pct`: % returning on day 1
- `day7_pct`: % returning on day 7
Return `signup_date`, `cohort_size`, `day1_pct`, `day7_pct` (rounded to 2 dp),
ordered by signup_date.
Tables
Example rows — the live problem includes the full dataset.
users
| user_id | signup_date |
|---|
activity
| activity_id | user_id | activity_date |
|---|
Expected output
Your answer should return 3 rows with the columns signup_date, cohort_size, day1_pct, day7_pct.
Starter code (SQL)
SELECT *
FROM users;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