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
Select Command
Distinct clause with Select Command
Where clause In SQL
Logical Operator in SQL SELECT Statement
IN Operator in SQL
BETWEEN Operator in SQL
Use of Wildcards in SQL
LIKE Operator in SQL
ORDER BY Clause in SQL
GROUP BY Clause in SQL
HAVING Clause in SQL
ALIAS In SQL
AS Keyword In SQL
INSERT INTO Command In SQL
Inserting Record In to a Table Form an other Table In SQL
UPDATE Command in SQL
DELETE Command in SQL
AVG Function in SQL