Write a SQL query to identify the top 5 most-watched genres by region over the last quarter.
Use the Prime Video viewing data represented by the provided tables. Define the last quarter relative to the current date, and exclude records with missing regions or genres.
Output
- One row per qualifying region and genre, with columns
region, genre, total_watch_minutes, and genre_rank.
- Return the five highest totals per region, breaking ties alphabetically by genre.
- Sort by
region, then genre_rank, then genre.
Output details
- Treat
DATE '2026-07-01' as today's date.
- Interpret last quarter as the immediately preceding calendar quarter, including its start and excluding its end.
- Preserve qualifying region-genre groups whose total watch minutes is
NULL; do not otherwise special-case zero values.