Menu

Friday, 14 February 2014

Avg() Function



It is used in numerical column to manage average of columns.
EmployeeID
EmployeeName
EmployeeMobNo
EmployeeAge
1
Mayank Dixit
9532771738
21
2
Mona Dixit
9005408263
22
3
Purnima
9485754875
23
4
Payal
9785458545
22
                                                          Employee

In the above employee table, we want to findout average of column (EmployeeAge).

Syntax

SELECT AVG (Column_Name) AS Alias_Column_Name
FROM Table_Name;

Example

SELECT AVG (EmployeeAge) AS AverageEmployeeAge
FROM Employee;

(Here AverageEmployeeAge is a subname (alias) of column.)

Output:-

AverageEmployeeAge
22

No comments: