Aggregates Aggregate

avg()

Calculates the average value for all tuples in x.

Arguments & returns

11 overloads

avg(x)

Aggregate
Overload link x Returns
#01 BIGINT DOUBLE
#02 DECIMAL DECIMAL
#03 DOUBLE DOUBLE
#04 HUGEINT DOUBLE
#05 INTEGER DOUBLE
#06 INTERVAL INTERVAL
#07 SMALLINT DOUBLE
#08 TIME TIME
#09 TIME WITH TIME ZONE TIME WITH TIME ZONE
#10 TIMESTAMP TIMESTAMP
#11 TIMESTAMP WITH TIME ZONE TIMESTAMP WITH TIME ZONE

Example

avg example
SQL
Haybarn WASM 1.5.5-rc3 · In your browser

Engine example with sample data · Run to view results.

In a query

Find the middle of the story.

Compare the average with the median to see how an unusually large value changes your summary.

Find the middle of the story.
SQL
Haybarn WASM 1.5.5-rc3 · In your browser

Guide recipe · Run to view results.