AVG

All functions > AGGREGATE > AVG

Returns the average of the values in the group.

Syntax

AVG(expr: T) → T
sql

Type Parameters:

  • T: Any numeric type (TINYINT, SMALLINT, INTEGER, BIGINT, FLOAT, DOUBLE, DECIMAL)

Arguments

ParameterTypeRequiredDescription
exprTYesThe numeric expression to average

Returns

The arithmetic mean of all non-NULL values

Notes

  • Calculates the arithmetic mean (sum divided by count)
  • NULL values are excluded from the calculation
  • Returns NULL if all values are NULL or group is empty
  • Result type matches input type
  • Can be used with WHERE clause to filter before aggregation
  • Can be used with GROUP BY clause for grouped aggregation

Examples

Last update at: 2025/10/13 10:23:46