← SQL Operations Cases

Lesson 2 of 4

Account for partial refunds

Aggregate multiple refunds before calculating net revenue.

Do the work

  1. An order may have more than one refund row.
  2. Sum refunds by order_id before joining.
  3. 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.