avg
Calculates the arithmetic mean.
Syntax
avg(x)
Arguments
x
— Values.
x
must be
Integer,
floating-point, or
Decimal.
Returned value
NaN
if the supplied parameter is empty.- Mean otherwise.
Return type is always Float64.
Example
Query:
SELECT avg(x) FROM values('x Int8', 0, 1, 2, 3, 4, 5)
Result:
┌─avg(x)─┐
│ 2.5 │
└────────┘
Example
Query:
CREATE table test (t UInt8) ENGINE = Memory;
SELECT avg(t) FROM test
Result:
┌─avg(x)─┐
│ nan │
└────────┘
当前内容版权归 ClickHouse 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 ClickHouse .