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
Article

OVER Keyword

Use with AI:Rippling AI ChatGPT Claude Cursor

Description​

Defines a window or user-specified set of rows within functions

Syntax​

window_function() 
OVER (
[PARTITION BY partition_expression]
ORDER BY sort_expression [ASC|DESC]
[ROWS or RANGE clause]
)

Parameters​

ParameterDescriptionRequired
PARTITION BYDivides the rows into groups (partitions); The window function is applied independently to each partitionYes
ORDER BYOrders rows within each partition; Important for functions like ROW_NUMBER(), LEAD(), LAG(), etcYes
ROWS or RANGEDefines a frame specifying which rows relative to the current row are included in the windowNo

Example​

SELECT 
e.full_name,
e.start_date,
MAX(e.start_date)
OVER (
PARTITION BY e.department) AS max_department_start_date
FROM
rippling.employee.Employee e;