7.23.2 Rules for specifying windows (partitions)
This subsection describes how rows are split into windows (partitions) and the order of rows inside the windows (partitions).
- Organization of this subsection
(1) How rows are split into windows (partitions)
The set of rows from the table to which the window specification applies is split into windows (partitions) based on the result of the value expression specified in the window partition clause. The rows that make up the windows (partitions) are determined according to the following rules:
-
When the result of the value expression in the window partition clause is not the null value
The windows (partitions) are composed of the rows for which the result of the value expression is the same value. For the comparison rules used to determine if two values are the same, see (1) Data types that can be compared in 6.2.2 Data types that can be converted, assigned, and compared.
-
When the result of the value expression in the window partition clause is the null value
The window (partition) is composed of the rows for which the result of the value expression is the null value.
(2) Order of rows inside the windows (partitions)
The order of rows inside the windows (partitions) is as follows:
-
If a window order clause is specified
The rows are ordered as specified in the sort specification list of the window order clause. For details about sort specification lists, see 7.24 Sort specification list.
-
If no window order clause is specified
No particular ordering can be assumed. The order of rows inside the windows (partitions) is determined by the order in which the rows are actually retrieved.