Section: Frame clause cheatsheet

Last 7 rows

sql
sql
ROWS BETWEEN 6 PRECEDING AND CURRENT ROW
Explanation

A classic moving window for row-based smoothing.

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing Frame clause cheatsheet
Current row only
Single-row frame.
OpenIn sheetsqlsame section
Current and next 3 rows
Forward-looking frame.
OpenIn sheetsqlsame section
Whole partition
Every row in the current partition.
OpenIn sheetsqlsame section
Count all rows without collapsing them
Return total row count on every row.
Aggregate within a partition
Compute a per-customer total on every row.
Assign row numbers inside each partition
Number rows in order within each customer.