ClickHouse/docs/en/sql-reference/aggregate-functions/reference/stddevpop.md
2024-04-29 07:25:38 +02:00

1.3 KiB

slug sidebar_position
/en/sql-reference/aggregate-functions/reference/stddevpop 30

stddevPop

The result is equal to the square root of varPop.

Alias:

  • STD
  • STDDEV_POP

:::note This function uses a numerically unstable algorithm. If you need numerical stability in calculations, use the stddevPopStable function. It works slower but provides a lower computational error. :::

Syntax

stddevPop(x)

Parameters

Returned value

Standard deviation of x. Float64.

Example

Query:

DROP TABLE IF EXISTS test_data;
CREATE TABLE test_data
(
    population UInt8,
)
ENGINE = Log;

INSERT INTO test_data VALUES (3),(3),(3),(4),(4),(5),(5),(7),(11),(15);

SELECT
    stddevPop(population) AS stddev
FROM test_data;

Result:

┌────────────stddev─┐
│ 3.794733192202055 │
└───────────────────┘