Top Category by User Segment
A medium SQL interview practice problem on DataDriven. Write and execute real sql code with instant grading.
- Domain
- SQL
- Difficulty
- medium
- Seniority
- L4
Problem
For every account status, find the product category with the highest number of purchases. If multiple categories are tied within a segment, include all of them. Show the account status, category, and purchase count, sequenced by account status and category.
Summary
Each segment has a favorite category.
Practice This Problem
Solve this SQL problem with real code execution. DataDriven runs your SQL queries against a real database and grades it automatically.