Skip to main content
All Problems
easy0% acceptance

Total Discount Amount Per Order

Calculate the total discount given on each order. The discount on each line item is quantity * unit_price * discount (where discount is a decimal fraction). Return order_id and total_discount_amount, only for orders where the total discount exceeds 10. Sort by total_discount_amount descending.

Schema

🔑idINT
🔗order_idINT
🔗product_idINT
quantityINT
unit_priceREAL
discountREAL
postgresql

Run your query to see results

Press Ctrl + Enter to execute