Running totals are a common SQL pattern in reporting, finance, and product analytics. Interviewers ask this to test whether you understand cumulative calculations and the SQL features used to produce them efficiently.
Explain how you would calculate a running total in SQL. In your answer, describe:
ORDER BY is required in the calculationThe interviewer is usually looking for a practical explanation centered on window functions, especially SUM() OVER (...). You should be able to explain the difference between a regular aggregate and a windowed aggregate, and give a simple example such as cumulative sales by date or cumulative revenue by customer.