Find the orders whose totals do not add up
Try this labAll DEA-C01 practice
- Certification
- DEA-C01
- Format
- SQL query
- Difficulty
- medium
- Estimated time
- 14 min
- Automated checks
- 8
SCENARIO
A checkout change has left some order headers disagreeing with their landed line items. Finance needs a trustworthy exception list before settlement, and an order whose line items never arrived is still an exception.
TASK
Repair order-total-audit.sql against orders and order_lines.
- Return exactly
order_id,expected_cents,calculated_cents, anddifference_centsfor each mismatch, once per order. calculated_centsincludes allline_centsand is zero when none arrived;difference_centsis expected minus calculated.- Exclude matching totals.