STDDEV
Returns the standard deviation of non-NULL values in a column with a numeric data type. If all records inside a group are NULL, returns NULL.
Syntax
STDDEV(col_name NUMERIC) → DOUBLE
- col_name: The name of the column for which to return the standard deviation. The values in the column must be numbers, such as INT, DOUBLE, or FLOAT.
Examples
STDDEV exampleSELECT STDDEV(tip_amount) FROM Samples."samples.dremio.com"."NYC-taxi-trips";
-- 2.2596650338662974
SELECT city, state, pop, STDDEV(pop)
OVER (PARTITION BY state ORDER BY city ROWS BETWEEN 1 PRECEDING AND 2 FOLLOWING)
FROM Samples."samples.dremio.com"."zips.json";
-- city, state, pop, EXPR$3
-- 98791, AK, 5345, 6476.127649555198
-- AKHIOK, AK, 13309, 6102.649479256257
-- AKIACHAK, AK, 481, 6429.897977417682
-- ...
Usage Notes
The STDDEV function supports optional PARTITION BY
, ORDER_BY
, and sliding window frame subclauses. See Window Functions for more information and syntax.