Syntax:-
SELECT AVG(column_name) FROM table_name
In this article, we are going to use the following table for some examples:-
CREATE TABLE [dbo]. [Employee](
[Empid] [Int] IDENTITY (1, 1) NOT NULL Primary key,
[EmpNumber] [nvarchar](50) NOT NULL,
[EmpFirstName] [nvarchar](150) NOT NULL,
[EmpLAStName] [nvarchar](150) NULL,
[EmpEmail] [nvarchar](150) NULL,
[Salary] [int] NULL
)
We insert following data into the above tables:-
Insert Into Employee (EmpNumber,EmpFirstName,EmpLAStName,EmpEmail,salary)
Values(‘A001′,’Vivek’,’Johari’,’samir@abcmail.com’,200000)
Insert Into Employee (EmpNumber,EmpFirstName,EmpLAStName,EmpEmail,salary)
Values(‘A002′,’Amit’,’Kumar’,’amit@abcmail.com’,100000)
Insert Into Employee (EmpNumber,EmpFirstName,EmpLAStName,EmpEmail,salary)
Values(‘A003′,’Neha’,’Sharma’,’neha@abcmail.com’,300000)
Insert Into Employee (EmpNumber,EmpFirstName,EmpLAStName,EmpEmail,salary)
Values(‘A004′,’Chandra’,’Singh’,’vivek@abcmail.com’,320000)
Insert Into Employee (EmpNumber,EmpFirstName,EmpLAStName,EmpEmail,salary)
Values(‘A005′,’Avinash’, ‘Dubey’,’avinash@abcmail.com’,250000)
For example,
Select AVG(salary) from employee
will give the given result:-
234000
Discover more from Technology with Vivek Johari
Subscribe to get the latest posts sent to your email.
… [Trackback]
[…] Read More to that Topic: techmixing.com/2014/08/avg-function-in-sql-server.html […]
… [Trackback]
[…] Find More on on that Topic: techmixing.com/2014/08/avg-function-in-sql-server.html […]
… [Trackback]
[…] Read More Info here on that Topic: techmixing.com/2014/08/avg-function-in-sql-server.html […]
… [Trackback]
[…] There you can find 85213 more Info on that Topic: techmixing.com/2014/08/avg-function-in-sql-server.html […]
… [Trackback]
[…] Find More here on that Topic: techmixing.com/2014/08/avg-function-in-sql-server.html […]
… [Trackback]
[…] Read More Info here on that Topic: techmixing.com/2014/08/avg-function-in-sql-server.html […]
… [Trackback]
[…] Find More here on that Topic: techmixing.com/2014/08/avg-function-in-sql-server.html […]
… [Trackback]
[…] Info to that Topic: techmixing.com/2014/08/avg-function-in-sql-server.html […]
… [Trackback]
[…] Info on that Topic: techmixing.com/2014/08/avg-function-in-sql-server.html […]
… [Trackback]
[…] Information to that Topic: techmixing.com/2014/08/avg-function-in-sql-server.html […]
… [Trackback]
[…] There you can find 84381 additional Info to that Topic: techmixing.com/2014/08/avg-function-in-sql-server.html […]
… [Trackback]
[…] Find More Information here to that Topic: techmixing.com/2014/08/avg-function-in-sql-server.html […]
… [Trackback]
[…] Find More on to that Topic: techmixing.com/2014/08/avg-function-in-sql-server.html […]
… [Trackback]
[…] Find More on that Topic: techmixing.com/2014/08/avg-function-in-sql-server.html […]
… [Trackback]
[…] Read More to that Topic: techmixing.com/2014/08/avg-function-in-sql-server.html […]
… [Trackback]
[…] Here you can find 88265 more Information on that Topic: techmixing.com/2014/08/avg-function-in-sql-server.html […]
… [Trackback]
[…] Find More here on that Topic: techmixing.com/2014/08/avg-function-in-sql-server.html […]
… [Trackback]
[…] Information to that Topic: techmixing.com/2014/08/avg-function-in-sql-server.html […]
… [Trackback]
[…] Find More here to that Topic: techmixing.com/2014/08/avg-function-in-sql-server.html […]
… [Trackback]
[…] Information to that Topic: techmixing.com/2014/08/avg-function-in-sql-server.html […]
… [Trackback]
[…] Read More on that Topic: techmixing.com/2014/08/avg-function-in-sql-server.html […]
… [Trackback]
[…] Read More to that Topic: techmixing.com/2014/08/avg-function-in-sql-server.html […]
… [Trackback]
[…] There you can find 23708 additional Information on that Topic: techmixing.com/2014/08/avg-function-in-sql-server.html […]
… [Trackback]
[…] Find More Info here to that Topic: techmixing.com/2014/08/avg-function-in-sql-server.html […]
… [Trackback]
[…] Find More on that Topic: techmixing.com/2014/08/avg-function-in-sql-server.html […]
… [Trackback]
[…] There you can find 89525 additional Info to that Topic: techmixing.com/2014/08/avg-function-in-sql-server.html […]
… [Trackback]
[…] There you can find 4282 more Info to that Topic: techmixing.com/2014/08/avg-function-in-sql-server.html […]
… [Trackback]
[…] Read More on on that Topic: techmixing.com/2014/08/avg-function-in-sql-server.html […]
… [Trackback]
[…] Find More Info here on that Topic: techmixing.com/2014/08/avg-function-in-sql-server.html […]