MySQL Select avg


Calculate Average

SELECT AVG() The FROM syntax is used to average the statistics from the data table.

grammar:

SELECT AVG(column) FROM tb_name

The SQL syntax is used to count the average number of a numeric type field. AVG() can not be multiple fields, while strings and other types can be executed, but they are meaningless.

example:

age
1
3
5
7
9
SELECT AVG(age) FROM user 
Result
5



Copyright 2014-2017 by DeveloperTut.com. All Rights Reserved.
TwitterGoogle+Facebook