Skip to main content
SQL • LESSON 188

Top Products

Which products generate the most revenue?

Advanced3 Minutes2010 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