Your question is Top 10 Users by Watch Time. Start with the requirements and the two 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.
Disney+ Hotstar wants to identify its most engaged users in India. Write a PostgreSQL query that ranks users by total watch time during January 2025.
IN region and sessions starting from 2025-01-01 through 2025-01-31.user_id ascending to break ties.| Column | Type | Description |
|---|---|---|
| user_idPK | INTEGER | Unique user identifier |
| display_name | VARCHAR(100) | User display name |
| region | VARCHAR(10) | User region code |
| Column | Type | Description |
|---|---|---|
| session_idPK | BIGINT | Unique viewing session identifier |
| user_id | INTEGER | User associated with the session |
| started_at | TIMESTAMP | Session start timestamp |
| watch_seconds | INTEGER | Number of seconds watched |