The running total increases as we move through the ordered recordsโ€ฆ

The running total increases as we move through the ordered records.

๐Ÿ”น 7. What is a Window Frame?

A Window Frame defines which rows around the current row are included in a window calculation.

Example:

SUM(amount) OVER (
ORDER BY sale_date
ROWS BETWEEN UNBOUNDED PRECEDING
AND CURRENT ROW
)


Let's understand the terms:

โ€ข ROWS specifies that the frame is based on physical rows.

โ€ข UNBOUNDED PRECEDING starts from the first row in the ordered partition.

โ€ข CURRENT ROW ends at the current row.

Other useful frame options:

โ€ข 1 PRECEDING โ†’ One row before the current row.

โ€ข 1 FOLLOWING โ†’ One row after the current row.

โ€ข UNBOUNDED FOLLOWING โ†’ Last row in the partition.

๐Ÿ”น 8. Window Functions vs GROUP BY

This is one of the most important SQL interview questions.
โค2
November 24, 2026 149