Top Earning Product in Each Category Using Subquery

Hard
subqueries Amazon Walmart Uber

Find the product with the highest total revenue (quantity * unit_price) in each category. Return category, product_name, and total_revenue, ordered by category.

Expected Output: One row per category — the top-earning product.

Tables

Hints (3 available)

SQL Editor

Output

Click "Run" to see results...