Top Product per Category
Medium
Window Functions
Return the best-selling product (highest revenue) in every category. In case of a tie return all tied products. Return category, product and revenue ordered by category, product.
Table schema
ProductSales(category VARCHAR(20), product VARCHAR(20), revenue INT)Sample data
category | product | revenue
Tech | Phone | 500
Tech | Laptop | 800
Home | Lamp | 100
Home | Chair | 100
Discussion
No discussions yet.
Shalyam Support
Hi! Ask us anything — we'll reply on WhatsApp or Telegram within 24 hours.