The AVG function returns the average value of a column in a selection. NULL values are not included in the calculation.
Syntax
SELECT AVG(column) FROM table |
Example
This example returns the average age of the persons in the "Persons" table:
SELECT AVG(Age) FROM Persons |
Result
32.67 |
Example
This example returns the average age for persons that are older than 20 years:
SELECT AVG(Age) FROM Persons WHERE Age>20 |
Result
39.5
No comments:
Post a Comment