Write a query utilizing window functions to rank the top three most-watched TV shows in each genre for a given week.
Use the week beginning 2025-01-06. Include only shows with a non-null genre and viewing records from that week.
genre, show_title, total_views, and genre_rank.| Column | Type | Description |
|---|---|---|
| show_idPK | INT | Unique identifier for the TV show |
| show_title | VARCHAR(150) | Title of the TV show |
| genre | VARCHAR(50) | Primary genre assigned to the show |
| Column | Type | Description |
|---|---|---|
| view_record_idPK | INT | Unique identifier for the weekly viewing record |
| show_id | INT | References the viewed show |
| week_start | DATE | First day of the reporting week |
| view_count | INT | Number of views recorded during the week |