Given a table of user streaming sessions, write a SQL query using window functions to find the top three most-watched genres for each user over the last 30 days.
Use CURRENT_DATE as the reference date. Sum watch minutes across sessions for the same user and genre. Exclude sessions without a genre. Return no more than three genres per user.
user_id, genre, total_watch_minutes, and genre_rank.user_id, genre_rank, and alphabetically by genre for deterministic ties.| Column | Type | Description |
|---|---|---|
| session_idPK | INT | Unique streaming session identifier |
| user_id | INT | Identifier of the streaming user |
| genre | VARCHAR(50) | Content genre watched during the session |
| watch_minutes | INT | Number of minutes watched in the session |
| session_start | TIMESTAMP | Timestamp when the session started |