Interview practice question
Top 3 products in each category
Data Analyst · SQL for Analytics · Beginner
How would you find the top three best-selling products in each category?
What a strong answer covers
Your AI report card counts how many of these ideas you cover.
- Aggregate sales per product.
- ROW_NUMBER/RANK OVER (PARTITION BY category ORDER BY sales DESC).
- Filter rank <= 3 in outer query.
- Decide tie handling.
- QUALIFY in some databases.
Practise this topic
Start without signing up. Sign in free to get an AI report card on your answer.