Back to Clickhouse

median

docs/en/sql-reference/aggregate-functions/reference/median.md

26.4.1.1-new1.7 KB
Original Source

median

The median* functions are the aliases for the corresponding quantile* functions. They calculate median of a numeric data sample.

Functions:

Example

Input table:

text
┌─val─┐
│   1 │
│   1 │
│   2 │
│   3 │
└─────┘

Query:

sql
SELECT medianDeterministic(val, 1) FROM t;

Result:

text
┌─medianDeterministic(val, 1)─┐
│                         1.5 │
└─────────────────────────────┘