← SQL Operations Cases
Lesson 2 of 4
Account for partial refunds
Aggregate multiple refunds before calculating net revenue.
Do the work
- An order may have more than one refund row.
- Sum refunds by order_id before joining.
- Net revenue equals amount minus total refund.
See the method
Order 1 refunds are 20 and 10.
Practice independently
Take it further
Inspect orphan refund records separately instead of forcing a match.