Top Three Titles by Playtime in Each Region
Last updated: November 29, 2026
Quick Overview
Using a play_sessions table (account_id, title_id, region, session_start, minutes), return for November 2026 the top three titles per region by total minutes played, with their distinct player counts, keeping ties.
PlayStation
November 29, 20260
0
0 solved
Using a play_sessions table (account_id, title_id, region, session_start, minutes), return for November 2026 the top three titles per region by total minutes played, with their distinct player counts, keeping ties.
Engagement by title and region feeds PlayStation Store merchandising and PS Plus catalog decisions, and SQL screens for data roles often start here. The interviewer checks aggregation before ranking, correct window function choice for ties, and a half-open date filter.
What the Interviewer Expects
- Aggregate to region and title before ranking
- Use DENSE_RANK or RANK deliberately and explain tie handling
- Filter with a half-open time range
- Count distinct players separately from minutes
- Order the output for readability
Key Topics to Cover
How to Approach This
- Clarify the schema and expected output format before writing queries.
- Use CTEs (WITH clauses) to break complex queries into readable steps.
- Consider window functions (ROW_NUMBER, RANK, LAG, LEAD) for ranking and sequential analysis.
- Watch for NULLs, duplicates, and edge cases in JOINs and GROUP BY.
- For pandas, prefer vectorized operations over row-by-row iteration.
Possible Follow-up Questions
- How would you rank by median minutes per player instead of total minutes?
- Sessions that span midnight on the month boundary: how do you attribute them?
- How would you exclude idle sessions where the console was left running?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice SQL ProblemsSample Answer
Clarify the Data
One row per play session. minutes is session length, region is the account's store region. I assume timestamps are UTC and a session is attributed to the month it started. Ties at the cutoff shoul...
Approach
First aggregate to one row per (region, title) with total minutes and distinct players. Then rank within region by total minutes using DENSE_RANK, and keep rank 3 or better. Filtering on rank must h...