Skip to main content
SQL โ€ข LESSON 188

Top Products

Which products generate the most revenue?

Advancedโฑ 3 Minutesโญ 2010 XP
๐Ÿค” THE QUESTION

Which products generate the most revenue?

๐Ÿ’ก WHAT IS IT?

Grouping line items by product_id, summing amounts, and taking the top 10 finds revenue leaders.

๐ŸŽฏ WHAT IS IT USED FOR?

Product catalog performance, inventory purchasing prioritization, sales leaderboards.

๐Ÿ’ป EXAMPLE
SELECT
product_id,
SUM(amount) AS revenue
FROM order_items
GROUP BY product_id
ORDER BY revenue DESC
LIMIT 10;

๐ŸŽฏ Mission Objectives

Practice typing production-grade SQL code for Top Products.

  • โœ“ Top product revenue
  • โœ“ SUM + ORDER BY DESC + LIMIT
  • โœ“ Catalog analysis
  • โœ“ Inventory prioritization