SQL Flow Field Guide

SELECT - OVER clause

Catalog support for SQL Server 2022 (16.x) and 2025 (17.x)

window computation: partition, order, frame; rows are not collapsed

What changes

Input
rows after HAVING, partitioned and ordered per the OVER spec
Output or change
same rows plus one computed column per window function

Syntax at a glance

OVER ( [ <PARTITION BY clause> ] [ <ORDER BY clause> ] [ <ROW or RANGE clause> ] )

Work example

A report needs a ranking or running value for each detail row without grouping the rows away.

Write the partition, order, and frame. Check the first and last row in each partition.

Check your work SELECT - OVER clause. The output keeps every input row and each window value uses the intended frame.

Open Microsoft Learn for full syntax, permissions, and details for your version.