Dataford
Interview QuestionsInterview GuidesExperiencesCoaching
New
Pricing
Get started
Dataford
Popular roles
Software EngineerData AnalystData ScientistData EngineerBusiness AnalystAI EngineerMachine Learning EngineerProduct Manager
Browse
Browse All RolesEvery role hub, from analyst to MLBrowse All CompaniesCompany-specific interview loopsAll Interview GuidesThe full guide library
Top questions by role
Software EngineerData AnalystData ScientistData EngineerBusiness AnalystAI EngineerMachine Learning EngineerProduct Manager
Top questions by skill
SQLPythonStatisticsMachine LearningA/B TestingSystem DesignGenerative AIProduct SenseMetricsBehavioral
Browse all questions →Try a mock interview
Experiences
Practice
Mock InterviewsTimed interview simulations with feedbackCoaching1:1 coaching with people at your target companiesSuccess PathYour 6-week structured planModulesCurated lessons by topicWebinarsTalks from ex-Big Tech data leadsPlaygroundA free-form scratch editor
Learn
BlogInterview strategy and career adviceTech Job Market ReportHiring trends across data and AI rolesFor UniversitiesDataford for career centersAbout DatafordWho we are and how we build
Pricing
Build my plan
Top Genres Per Region Query
00:00
5 left

Top Genres Per Region Query

MediumSQL · PostgreSQL

Problem

Given Paramount streaming viewing history and content metadata tables, write a query to find the top 3 most-watched genres per region.

Treat total minutes watched as the measure of popularity. Exclude records with missing regions, missing genres, or non-positive viewing minutes. Return three genres per region, breaking equal totals alphabetically.

Output

  1. One row per qualifying region and genre, with columns region, genre, total_minutes_watched, and genre_rank
  2. Include only ranks 1 through 3, ordered by region, genre_rank, then genre

Schema

viewing_history
ColumnTypeDescription
view_idPKINTUnique viewing event identifier
content_idINTViewed content identifier
regionVARCHAR(50)Viewer region
minutes_watchedINTMinutes watched during the viewing event
content_metadata
ColumnTypeDescription
content_idPKINTUnique content identifier
titleVARCHAR(200)Paramount content title
genreVARCHAR(80)Primary content genre
Tablesviewing_historycontent_metadata
Interviewer

Your question is Top Genres Per Region Query. Start with the requirements and the two tables in the Question tab.

Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.

You need to log in / sign up to run or submit.
CodePostgreSQL
Sign up free to run your codeLog inLn 1
Run your query to see results here.