Window name clause
Defines a named window that specifies window partition and order clauses for an analytic function. This window is specified in the function's OVER clause. Named windows can be useful when you write queries that invoke multiple analytic functions with similar OVER clauses, such as functions that use the same partition (PARTITION BY) clauses.
Syntax
WINDOW window-name AS ( window-partition-clause [window-order-clause] )
Arguments
- WINDOW- window-name
- A window name that is unique within the same query.
- 
window-partition-clause [window-order-clause]
- 
Clauses to invoke when an OVERclause references this window.If the window definition omits a window order clause, the OVERclause can specify its own order clause.
Requirements
- 
A WINDOWclause cannot include a window frame clause.
- 
Each WINDOWclause within the same query must have a unique name.
- 
A WINDOWclause can reference another window that is already named. For example, the following query names windoww1beforew2. Thus, theWINDOWclause that definesw2can referencew1:=> SELECT RANK() OVER(w1 ORDER BY sal DESC), RANK() OVER w2 FROM EMP WINDOW w1 AS (PARTITION BY deptno), w2 AS (w1 ORDER BY sal);
Examples
See Named windows.