Transactions that do not balance
Your task
In double-entry bookkeeping every transaction must sum to zero. Find any that do not. Return txn_id and imbalance_cents, ordered by transaction.
If the books are clean, the correct answer is no rows.
Tables
ledger_account
| idINTEGER | nameTEXT | kindTEXT |
|---|---|---|
| 1 | Cash | asset |
| 2 | Revenue | income |
| 3 | Fees | expense |
| 4 | Refunds | expense |
entry
More rows not shown
| idINTEGER | txn_idINTEGER | account_idINTEGER | amount_centsINTEGER | booked_onTEXT |
|---|---|---|---|---|
| 1 | 100 | 1 | 50000 | 2026-01-05 |
| 2 | 100 | 2 | -50000 | 2026-01-05 |
| 3 | 101 | 1 | -1500 | 2026-01-05 |
| 4 | 101 | 3 | 1500 | 2026-01-05 |
| 5 | 102 | 1 | 32000 | 2026-02-09 |
| 6 | 102 | 2 | -32000 | 2026-02-09 |