By Michael Nocito, data analyst · Published August 8, 2026

By the end of this page you can add a cumulative column to any ordered result, write the frame clause that says exactly which rows are being added, run separate totals for each group in one pass, turn the same shape into a moving average, and check the whole thing with one comparison. It is about twenty-five minutes, and every result below was run.

Here is what to do today. Find your running-total query and look for the words ROWS BETWEEN. If they are not there, you are using the default frame, and on any column with repeated values the default frame gives every tied row the same cumulative figure. Add ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW and compare the two.

The short version: SUM(x) OVER (ORDER BY y) adds up a frame of rows that ends at the current one, and the frame clause is what decides where it ends.

The frame growing one row at a time is the idea, so it gets the picture.