App Time Split by Age Group
Problem
**[Asked at Snapchat]**
Snapchat tracks time users spend on two activity types: sending snaps and opening
snaps. The product team wants to know how that split varies by age group.
For each age group, calculate:
- `send_pct` — percentage of total time spent **sending**
- `open_pct` — percentage of total time spent **opening**
Round both to 2 decimal places. Order by age group.
Tables
Example rows — the live problem includes the full dataset.
snap_activity
| activity_id | user_id | activity_type | time_spent |
|---|
user_demographics
| user_id | age_group |
|---|
Expected output
Your answer should return 3 rows with the columns age_group, send_pct, open_pct.
Starter code (SQL)
SELECT *
FROM snap_activity;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