How would you identify the top 5 most viewed shows in each region given a table of Hotstar user logs?
Assume each log row represents one view. Join logs to users to obtain the viewer's region and to shows to obtain show details. Exclude logs without a valid user or show, and exclude users whose region is unknown.
Output
- One row per selected show and region with columns
region, show_id, show_title, view_count, and region_rank.
- Include at most five shows per region, ordered by view count descending, then show title ascending for deterministic tie-breaking.
- Sort the final result by
region ascending and region_rank ascending.