RosettaCodeData/Task/Cumulative-standard-deviation/DuckDB/cumulative-standard-deviation.duckdb
2025-08-11 18:05:26 -07:00

7 lines
352 B
Text

# Create a table with the data together with a sequence number
CREATE OR REPLACE TABLE t AS
SELECT generate_subscripts(l, 1) as id, unnest(l)::DOUBLE as x,
from (values ([2,4,4,4,5,5,7,9])) tbl(l) ;
# Compute the rolling standard deviations without the Bessel adjustment:
SELECT *, stddev_pop(x) OVER (ORDER BY id) as 'cumulative stddev' FROM t;