mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-25 09:02:00 +00:00
2.0 KiB
2.0 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.medianDD
— Alias for quantileDD.
Example
Input table:
┌─val─┐
│ 1 │
│ 1 │
│ 2 │
│ 3 │
└─────┘
Query:
SELECT medianDeterministic(val, 1) FROM t;
Result:
┌─medianDeterministic(val, 1)─┐
│ 1.5 │
└─────────────────────────────┘