SQL/MX 2.x Reference Manual (G06.24+, H06.03+)
SQL/MX Functions and Expressions
HP NonStop SQL/MX Reference Manual—523725-004
9-177
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.