SQL · Intermediate · 35 min

Accounts that disagree after migration

Find missing, extra, and changed records even when counts match.

Task

Compare source_accounts and target_accounts after a migration. Normalize account IDs by trimming spaces and converting to lower case. Report every missing, target-only, or changed balance.

Requirements

  • Both tables have account_id and balance_cents. IDs are unique after normalization.
  • A null balance is a legitimate unknown value. Null equals null for reconciliation, but differs from a known balance.
  • Return account_id and issue, using missing, target_only, or changed. Order by account_id.
  • Equal total balances or row counts do not prove that records match. Use SQLite.
ReconciliationNULL handlingSet comparison

Loading exercise…