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


Example

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:

NameAge
Allie17
Amanda14
Alana20

You could write this statement to get the minimum, maximum and average value:

SELECT min(age), max(age), avg(age)
FROM individuals;

Result:

minmaxavg
142017