mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-24 08:32:02 +00:00
1.9 KiB
1.9 KiB
slug | sidebar_position |
---|---|
/en/sql-reference/aggregate-functions/reference/median | 212 |
median
The median*
functions are the aliases for the corresponding quantile*
functions. They calculate median of a numeric data sample.
Functions:
median
— Alias for quantile.medianDeterministic
— Alias for quantileDeterministic.medianExact
— Alias for quantileExact.medianExactWeighted
— Alias for quantileExactWeighted.medianTiming
— Alias for quantileTiming.medianTimingWeighted
— Alias for quantileTimingWeighted.medianTDigest
— Alias for quantileTDigest.medianTDigestWeighted
— Alias for quantileTDigestWeighted.medianBFloat16
— Alias for quantileBFloat16.
Example
Input table:
┌─val─┐
│ 1 │
│ 1 │
│ 2 │
│ 3 │
└─────┘
Query:
SELECT medianDeterministic(val, 1) FROM t;
Result:
┌─medianDeterministic(val, 1)─┐
│ 1.5 │
└─────────────────────────────┘