Interview practice question
Running balance per account
Data Engineering · SQL · Intermediate
Calculate a running balance for each bank account from a transactions table with credits and debits.
What a strong answer covers
Your AI report card counts how many of these ideas you cover.
- Convert debits to negative amounts.
- SUM over a window partitioned by account ordered by time.
- Use ROWS frame to avoid tie issues.
- Add a tie-breaker for transactions at the same timestamp.
- Start from an opening balance if needed.
Practise this topic
Start without signing up. Sign in free to get an AI report card on your answer.