Section: Frame clause cheatsheet

Current and next 3 rows

sql
sql
ROWS BETWEEN CURRENT ROW AND 3 FOLLOWING
Explanation

Handy for queueing, forecast windows, or lead-like summaries.

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
Last 7 rows
Rolling seven-row 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.