Relational Data - Aggregate Functions - Reference - Stddevpop

From FojiSoft Docs
Revision as of 18:44, 28 August 2024 by Chris.Hansen (talk | contribs) (Import ClickHouse Docs: Wed Aug 28 2024 14:44:03 GMT-0400 (Eastern Daylight Time))
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

The result is equal to the square root of varPop.

Aliases: STD, STDDEV_POP.

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

  • Square root of 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 │
└───────────────────┘