Top Per Category
A hard SQL interview practice problem on DataDriven. Write and execute real sql code with instant grading.
- Domain
- SQL
- Difficulty
- hard
- Seniority
- L4
Problem
Editorial wants to feature the top-rated product in every category. Within each category, find the product(s) with the highest rating and include all ties. Skip products with no rating. Return the product_name, category, and rating.
Summary
Every category has a champion. Crown them all.
Practice This Problem
Solve this SQL problem with real code execution. DataDriven runs your SQL queries against a real database and grades it automatically.