SQL Practice Logo

SQLPractice Online

Level 4 - Mid-LevelDebugging Questions

Debug: Wrong Partition in Running Total

Fix the logic bug. Running total should reset per account. SELECT account_id, txn_date, amount, SUM(amount) OVER (ORDER BY txn_date) AS running_balance FROM transactions;

Schema Context

transactions(account_id, txn_date, amount)