AVG Function in SQL
By S.Qasim
Published: 14 May 2013
SQL Functions
AVG Function in SQL
AVG function in SQL is use to calculate the Average of Numeric values. The general syntax of AVG function is:
Syntax is :
SELECT AVG(column-name) FROM table-name ;
The table below contain the monthly income report.
TABLE_A
| Month | Income |
| March | 50000 |
| April | 42000 |
| May | 28000 |
| Jun | 58000 |
the following statement calculate the Average payment of the Month.
SELECT AVG(Income) FROM table_A ;
The above statement return the Following Result
AVG(Income)
---------------
44500
You can also use ALIAS Clause with AS keyword in this function. (ALIAS is temporary name of the Column) for example:
SELECT AVG(Income) AS "Average_Income" FROM table_A ;
The above statement return the Following Result
Average_incmoe
---------------
44500