001Level 1

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.

Peek at the solution?

You can still earn the XP afterwards by submitting a working query — but you'll learn more if you give it one more try.