Routine~13min

The Discount Cap Breach

Four coupon codes have a maximum discount amount cap — no order should save more than the cap regardless of order size. But 21 applications have a discount_amount that exceeds the coupon's cap. A percentage was calculated correctly but the cap check was skipped for high-value orders. BIGSALE30 has no cap — its large discounts are fine.

Tables you'll query

couponsorder_coupons

What you'll learn

JOINsSELECT & Filtering
Investigate this case →