ClickHouse/docs/en/sql-reference/aggregate-functions/reference/stddevsampstable.md

1.2 KiB

slug sidebar_position
/en/sql-reference/aggregate-functions/reference/stddevsampstable 31

stddevSampStable

The result is equal to the square root of varSamp. Unlike stddevSamp This function uses a numerically stable algorithm. It works slower but provides a lower computational error.

Syntax

stddevSampStable(x)

Parameters

Returned value

Square root of sample variance 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
    stddevSampStable(population)
FROM test_data;

Result:

┌─stddevSampStable(population)─┐
│                            4 │
└──────────────────────────────┘