Your question is Retention Rate for a Series. Start with the requirements and the three tables on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Prime Video wants to measure whether viewers return to watch the same series after their initial viewing. Write a PostgreSQL query to calculate the 30-day retention rate for users who first watched series 101, The Peripheral, during January 2025.
101 occurred from 2025-01-01 through 2025-01-31.101 again more than 0 and no more than 30 days after their first qualifying view.| Column | Type | Description |
|---|---|---|
| user_idPK | INT | Prime Video user identifier |
| region | VARCHAR(30) | User region |
| Column | Type | Description |
|---|---|---|
| series_idPK | INT | Series identifier |
| title | VARCHAR(150) | Series title |
| genre | VARCHAR(50) | Series genre |
| Column | Type | Description |
|---|---|---|
| event_idPK | INT | Viewing event identifier |
| user_id | INT | Viewer identifier referencing users |
| series_id | INT | Watched series identifier referencing series |
| watched_at | TIMESTAMP | Time of the viewing event |
| watch_seconds | INT | Number of seconds watched |