Your question is Running Totals for Sales Reporting. Take a moment with it on the right.
Talk me through your thinking if you like. When you're confident, submit your answer and I'll grade it like a real screen (7/10 or better passes).
Running totals are common in reporting dashboards, finance, and product analytics. Interviewers ask this to test whether you understand cumulative calculations, row ordering, and when to use window functions instead of grouped aggregates.
Explain how you would compute a running total in SQL. Your answer should cover:
SUM() OVER (...) is typically the right approachORDER BY changes the resultGROUP BY with window functionsAssume the interviewer expects a practical explanation using PostgreSQL syntax, not just a definition. You should be able to describe the pattern, show a short example query, and explain edge cases like duplicate dates, partitions, and NULL values.