ClickHouse/docs/en/sql-reference/aggregate-functions/reference/median.md
2024-06-24 14:32:52 +02:00

2.0 KiB

slug sidebar_position
/en/sql-reference/aggregate-functions/reference/median 167

median

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

Functions:

Example

Input table:

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

Query:

SELECT medianDeterministic(val, 1) FROM t;

Result:

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