Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Running Totals for Sales Reporting

MediumSQL & Data Manipulation00:00
Practice interviewer
In session
5 left
00:00

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).

You need to log in / sign up to chat or submit.

Problem

Context

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.

Core Question

Explain how you would compute a running total in SQL. Your answer should cover:

  1. What a running total is
  2. Why SUM() OVER (...) is typically the right approach
  3. How ORDER BY changes the result
  4. When you need to aggregate first before applying the running total
  5. Common mistakes, such as missing tie-breakers or confusing GROUP BY with window functions

Scope Guidance

Assume 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.