Interview practice question
Top five products by revenue
Data Engineering · SQL · Beginner
Find the top 5 products by total revenue. What if two products tie for fifth place?
What a strong answer covers
Your AI report card counts how many of these ideas you cover.
- GROUP BY product and SUM revenue.
- ORDER BY revenue DESC LIMIT 5 is the simple answer.
- LIMIT cuts ties arbitrarily.
- Use RANK or DENSE_RANK to include ties.
- Join to product table for names.
Practise this topic
Start without signing up. Sign in free to get an AI report card on your answer.