# Tutorial by Examples: avg

## AVG()

The aggregate function AVG() returns the average of a given expression, usually numeric values in a column. Assume we have a table containing the yearly calculation of population in cities across the world. The records for New York City look similar to the ones below: EXAMPLE TABLE city_namepopula...

## Using sum, avg, min or max on a collection for statistical calculations

Collections also provide you with an easy way to do simple statistical calculations. \$books = [ ['title' =&gt; 'The Pragmatic Programmer', 'price' =&gt; 20], ['title' =&gt; 'Continuous Delivery', 'price' =&gt; 30], ['title' =&gt; 'The Clean Coder', 'price' =&gt; 10], ] \$min = col...

## Simple statistics: min(), max(), avg()

In order to determine some simple statistics of a value in a column of a table, you can use an aggregate function. If your individuals table is: NameAgeAllie17Amanda14Alana20 You could write this statement to get the minimum, maximum and average value: SELECT min(age), max(age), avg(age) FROM i...

## AVG()

Returns average of numeric values in a given column. We have table as shown in figure that will be used to perform different aggregate functions. The table name is Marksheet. Select AVG(MarksObtained) From Marksheet The average function doesn't consider rows with NULL value in the field used ...

## Avg aggregation

This is a single value metrics aggregation that calculates the average of the numeric values that are extracted from the aggregated documents. POST /index/_search? { &quot;aggs&quot; : { &quot;avd_value&quot; : { &quot;avg&quot; : { &quot;field&quot; : &quot;name_of_field&quot; } } ...

Page 1 of 1