Interview practice question
Daily balance from sparse transactions
Data Engineering · SQL · Experienced
You have account transactions only on days with activity. Produce each account's end-of-day balance for every calendar day.
What a strong answer covers
Your AI report card counts how many of these ideas you cover.
- Compute running balance per account per transaction day.
- Cross join accounts with a date spine for their active range.
- Carry forward the last known balance to days without activity.
- Use LAST_VALUE IGNORE NULLS or a join to the latest date <= day.
- Watch the size: accounts times days can be huge.
Practise this topic
Start without signing up. Sign in free to get an AI report card on your answer.