For AI agents: an index of this documentation is at https://developer.rippling.com/llms.txt. Public pages have a Markdown version at the same URL with .md added.

Skip to main content
index

ROWS Keyword

Use with AI:Rippling AI ChatGPT Claude Cursor

Description​

Specifies rows within a function

Syntax​

window_function() 
OVER (
[PARTITION BY partition_expression]
ORDER BY sort_expression [ASC | DESC]
ROWS BETWEEN frame_start AND frame_end
)

Parameters​

ParametersDescriptionRequired
PARTITION BYDivides rows into groups before numbering restarts in each groupNo
ORDER BYDefines the order in which row numbers are assignedYes

Common ROWS frame options​

Frame OptionMeaning
ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROWFrom the first row in the partition to the current row
ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWINGFrom the current row to the last row
ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWINGOne row before and one row after
ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWINGEntire partition

Example​

SELECT 
MIN(e.start_date) OVER (
PARTITION BY e.department
ORDER BY e.id
ROWS BETWEEN UNBOUNDED PRECEDING
AND UNBOUNDED FOLLOWING
) AS dates
FROM
rippling.employee.Employee e;