First page Back Continue Last page Image

The Syntax of a Window Statement

OVER([PARTITION BY expression1 [, expression2]…

[ORDER BY expression1 [ASC|DESC]

[, expression2 [ASC|DESC]]...)

The OVER Clause determines the Window (Sets of Rows) that will be used

PARTITION BY splits the results into partitions (or groups) that the Window function will be applied to

A Window is similar to a GROUP BY but a GROUP BY just does the aggregate values with no detail while a Window allows you to do aggregates and retain the detail