Simple statistics min max avg
suggest changeIn 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:
| Name | Age |
|---|---|
| Allie | 17 |
| Amanda | 14 |
| Alana | 20 |
You could write this statement to get the minimum, maximum, and average value. min and max of an integer column return integer. avg returns numeric.
SELECT min(age), max(age), avg(age)
FROM individuals;
Result:
| min | max | avg |
|---|---|---|
| 14 | 20 | 17 |
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents