Skip to main content
Admissions guidance, study banks, and career tools — get started on Shalyam

Top Product per Category

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.

Rewards · v2.1

Join Shalyam Newsletter

Get exclusive insights with every issue: education, research and innovation news.

One email a week. Unsubscribe any time.