SQL/MX 2.x Reference Manual (H06.04+)

SQL/MX Functions and Expressions
HP NonStop SQL/MX Reference Manual540440-003
9-170
Examples of VARIANCE
°
Find the variance of the TEMPERATURE column:
SELECT VARIANCE(temperature) FROM weather;
(EXPR)
-------------------------
1.64500000000000024E+002
--- 1 row(s) selected.
°
Find the variance of the TEMPERATURE column by CITY:
SELECT city, VARIANCE (temperature)
FROM weather GROUP BY city;
CITY (EXPR)
---------- -------------------------
Austin 3.55666666666666720E+002
Cupertino 0.00000000000000000E+000
--- 2 row(s) selected.
°
Find the weighted variance of the TEMPERATURE column:
SELECT VARIANCE (temperature, weight) FROM weather;
(EXPR)
-------------------------
1.46363636363636384E+002
--- 1 row(s) selected.