Running balance for each e-wallet
A transactions table logs top-ups (positive amounts) and payments (negative amounts) for e-wallet accounts. Support needs to see the running balance after each transaction, per wallet, so they can spot the exact transaction where a wallet first went negative.
Return wallet_id, txn_date, amount and running_balance (the cumulative sum of amount for that wallet, up to and including that row), ordered by wallet_id then txn_date.
Schema
| txn_id | INT |
| wallet_id | TEXT |
| txn_date | DATE |
| amount | NUMERIC |
Example input
Stuck? Ask the coach for a nudge that won't give the answer away, or reveal the reference solution and a short walkthrough of why it works.