Loading...

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
mid

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.

Practice This Problem

Solve this SQL problem with real code execution. DataDriven runs your SQL queries against a live PostgreSQL database and grades it instantly.