Chapter 2 · Filtering
04. Order Items with Discounts Applied
Easy10 XPE-Commerce
Find all order items where a discount was applied (discount > 0). The discount column is the dollar amount taken off that line. Return the order_id, product_id, quantity, unit_price, discount, and the net line total calculated as quantity * unit_price - discount (rounded to 2 decimals). Sort by net line total 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.