Chapter 4 · Aggregations
50. Revenue Impact of Discounts
Medium20 XPE-Commerce
Compare gross revenue vs net revenue across all order items. The discount column is the dollar amount taken off each line. Calculate total gross revenue (quantity * unit_price), total discount (sum of discount), and total net revenue (gross - discount). Return a single row with gross_revenue, total_discount, and net_revenue, all rounded to 2 decimal places.
Tables
- PKidINT
- FKorder_id→ orders.idINT
- FKproduct_id→ products.idINT
- quantityINT
- unit_priceREAL
- discountREAL
Need help?
Ask Sol
AI tutor — looks at your current query and nudges you, without spoiling the answer.
Solution
Try the hints first — solving it yourself is what makes it stick.