Examples Of Variance - HP Neoview SQL Reference Manual

Hide thumbs Also See for Neoview SQL:
Table of Contents

Advertisement

where vi is the i-th value of expression, wi is the i-th value of weight, and N is the cardinality
of the result table.
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 expressions are valid:
VARIANCE (SALARY)
VARIANCE (SALARY * 1.1)
VARIANCE (PARTCOST * QTY_ORDERED)
Nulls
VARIANCE is evaluated after eliminating all nulls from the set. If the result table is empty,
VARIANCE returns NULL.
FLOAT(54) and DOUBLE PRECISION Data
Avoid using large FLOAT(54) or DOUBLE PRECISION values as arguments to VARIANCE. If
SUM(x * x) exceeds the value of 1.15792089237316192e77 during the computation of
VARIANCE(x), then a numeric overflow occurs.

Examples of VARIANCE

Compute the variance of the salary of the current employees:
SELECT VARIANCE(salary) AS Variance_Salary
FROM persnl.employee;
VARIANCE_SALARY
-------------------------
1.27573263588496116E+009
--- 1 row(s) selected.
Compute the variance of the cost of parts in the current inventory:
SELECT VARIANCE (price * qty_available)
FROM sales.parts;
(EXPR)
-------------------------
5.09652410092950336E+013
--- 1 row(s) selected.
486
SQL Functions and Expressions

Advertisement

Table of Contents
loading

Table of Contents