DataLane

17. Reconcile orders against payments

hardProNot started~14 minData qualityJoins

Asked in screens shaped like: Stripe, Capital One, Wise

A revenue report and a settlement report disagree. Find the orders where the paid amount does not match the order amount — this is the reconciliation check that belongs in a data quality test, not a dashboard.

Requirements

  • Columns: order_id, order_amount, paid_amount, diff
  • Only orders that have a payment row and where the two amounts differ
  • Compare both amounts rounded to 2 decimals
  • diff is order_amount - paid_amount, ordered by diff descending then order_id

Expected output

order_id, order_amount, paid_amount, diff

Row order is graded, so ORDER BY matters here.

SQL editor

Loading SQL engine…

Ctrl/Cmd + Enter submits

Run your query to see the result set.

Pro problem

Hard problems unlock with Pro

Easy pads stay free. Medium and hard SQL and Python problems — editor, tests, hints, and solutions — open after you upgrade to Pro or coaching.

See plansPractice free easy problems
↑↓ navigate openesc close