Movingstddev Function; Example Of Movingstddev - HP Neoview SQL Reference Manual

Hide thumbs Also See for Neoview SQL:
Table of Contents

Advertisement

MOVINGSTDDEV Function

The MOVINGSTDDEV function is a sequence function that returns the standard deviation of
nonnull values of a column in the current window of an intermediate result table ordered by a
SEQUENCE BY clause in a SELECT statement. See
MOVINGSTDDEV is a Neoview SQL extension.
MOVINGSTDDEV (column-expression,integer-expression
column-expression
specifies a derived column determined by the evaluation of the column expression.
integer-expression
is an SQL numeric value expression of signed data type SMALLINT or INTEGER that specifies
the current window. The current window is defined as the current row and the previous
(integer-expression - 1) rows.
max-rows
is an SQL numeric value expression of signed data type SMALLINT or INTEGER that specifies
the maximum number of rows in the current window.
Note these considerations for the window size:
The actual value for the window size is the minimum of integer-expression and
max-rows.
If these conditions are met, MOVINGSTDDEV returns the same result as
RUNNINGSTDDEV:
— The integer-expression is out of range, and max-rows is not specified. This
— The minimum of integer-expression and max-rows is out of range. In this
The number of rows is out of range if it is larger than the size of the result table, negative,
or NULL.

Example of MOVINGSTDDEV

Return the standard deviation of nonnull values of a column in the current window of three
rows:
SELECT MOVINGSTDDEV (I1,3) AS MOVINGSTDDEV3
FROM mining.seqfcn
SEQUENCE BY TS;
MOVINGSTDDEV3
-------------------------
0.00000000000000000E+000
1.55273578080753976E+004
1.48020166531456112E+004
1.51150124820766640E+004
6.03627542446499008E+003
--- 5 row(s) selected.
Note that you can use the CAST function for display purposes. For example:
SELECT CAST(MOVINGSTDDEV (I1,3) AS DEC (18,3))
FROM mining.seqfcn
SEQUENCE BY TS;
(EXPR)
--------------------
372
SQL Functions and Expressions
[,max-rows])
condition includes the case in which both integer-expression and max-rows
are larger than the result table.
case, integer-expression could be within range, but max-rows might be the
minimum value of the two and be out of range (for example, a negative number).
"SEQUENCE BY Clause" (page
268).

Advertisement

Table of Contents
loading

Table of Contents