SQL/MX 2.x Reference Manual (G06.24+, H06.03+)
SQL/MX Functions and Expressions
HP NonStop SQL/MX Reference Manual—523725-004
9-148
Examples of STDDEV
Data Type of the Result
The data type of the result is always DOUBLE PRECISION.
Operands of the Expression
The expression includes columns from the rows of the SELECT result table but cannot
include an aggregate function. These are valid:
STDDEV (SALARY)
STDDEV (SALARY * 1.1)
STDDEV (PARTCOST * QTY_ORDERED)
Nulls
STDDEV is evaluated after eliminating all nulls from the set. If the result table is empty,
STDDEV returns NULL.
FLOAT(54) and DOUBLE PRECISION Data
Avoid using large FLOAT(54) or DOUBLE PRECISION values as arguments to
STDDEV. If SUM(x * x) exceeds the value of 1.15792089237316192e77 during the
computation of STDDEV(x), a numeric overflow occurs.
Examples of STDDEV
•
Compute the standard deviation of the salary of the current employees:
SELECT STDDEV(salary) AS StdDev_Salary
FROM persnl.employee;
STDDEV_SALARY
-------------------------
3.57174062500000000E+004
--- 1 row(s) selected.
•
Compute the standard deviation of the cost of parts in the current inventory:
SELECT STDDEV (price * qty_available)
FROM sales.parts;
(EXPR)
-------------------------
7.13899499999999808E+006
--- 1 row(s) selected.