Loading...

Top Per Category

A hard SQL interview practice problem on DataDriven. Write and execute real sql code with instant grading.

Domain
SQL
Difficulty
hard

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.

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.