Chapter 4 · Aggregations
14. Total Discount Amount Per Order
Easy10 XPE-Commerce
Calculate the total discount given on each order. The discount column on order_items is the dollar amount taken off that line. Return order_id and total_discount_amount (rounded to 2 decimals), only for orders where the total discount exceeds 10. Sort by total_discount_amount descending.
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.