Oracle’s Window Syntax
Oracle’s window function syntax is as follows:
FUNCTION_NAME
(expr
) OVER (window_clause
)window_clause
::= [partitioning
] [ordering
[framing
]]partitioning
::= PARTITION BYvalue
[,value
...]ordering
::= ORDER [SIBLINGS] BYrule
[,rule
...]rule
::= {value
|position
|alias
} [ASC | DESC] [NULLS {FIRST | LAST}]framing
::= {ROWS | RANGE} {not_range
|begin
ANDend
}not_range
::= {UNBOUNDED PRECEDING | CURRENT ROW |value
PRECEDING}begin
::= {UNBOUNDED PRECEDING | CURRENT ROW |value
{PRECEDING | FOLLOWING}}end
::= {UNBOUNDED FOLLOWING | CURRENT ROW |value
{PRECEDING | FOLLOWING}}
Get SQL in a Nutshell, 3rd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.