FunctionsAggregate FunctionsAggregate FunctionsavgEdit this pageavg Calculates the arithmetic mean. Syntax avg(x) Arguments x — input values, must be Integer, Float, or Decimal. Returned value The arithmetic mean, always as Float64. NaN if the input parameter x is empty. Example Query: SELECT avg(x) FROM VALUES('x Int8', 0, 1, 2, 3, 4, 5); Result: ┌─avg(x)─┐ │ 2.5 │ └────────┘ Example Create a temp table: Query: CREATE TABLE test (t UInt8) ENGINE = Memory; Get the arithmetic mean: Query: SELECT avg(t) FROM test; Result: ┌─avg(x)─┐ │ nan │ └────────┘