Hitachi

Hitachi Advanced Database SQL Reference


7.23.4 Rules for specifying the window frame (when ROWS is specified in the window frame clause)

When ROWS is specified in the window frame clause, the upper and lower boundaries of the window frame are determined as follows.

Organization of this subsection

(1) The upper boundary of the window frame

(a) When the window frame start boundary is UNBOUNDED PRECEDING

The first row of the window frame (the upper boundary) will be the first row of the window (partition).

[Figure]

(b) When the window frame start boundary is CURRENT ROW

The first row of the window frame (the upper boundary) will be the current row.

[Figure]

(c) When the window-frame-start-boundary is window-frame-value-specification PRECEDING

The first row of the window frame (the upper boundary) will be the row that is found by counting up from the current row the number of rows in window-frame-value-specification.

[Figure]

(d) When the window frame start boundary is window-frame-value-specification FOLLOWING

The first row of the window frame (the upper boundary) will be the row that is found by counting down from the current row the number of rows in window-frame-value-specification.

[Figure]

(2) The lower boundary of the window frame

(a) When the window frame end boundary is UNBOUNDED FOLLOWING

The last row of the window frame (the lower boundary) will be the last row of the window (partition).

[Figure]

(b) When the window frame end boundary is CURRENT ROW

The last row of the window frame (the lower boundary) will be the current row.

[Figure]

(c) When the window frame end boundary is window-frame-value-specification PRECEDING

The last row of the window frame (the lower boundary) will be the row that is found by counting up from the current row the number of rows in window-frame-value-specification.

[Figure]

(d) When the window frame end boundary is window-frame-value-specification FOLLOWING

The last row of the window frame (the lower boundary) will be the row that is found by counting down from the current row the number of rows in window-frame-value-specification.

[Figure]