SQL query that would return the average salary per department using AVG as Analytical function

Posted by Rajnilari2015 under Sql Server category on | Points: 40 | Views : 1122
Let's say we have a table tblTest as under

Name          		Salary          	Department

Debasis Dey 15000 IT Software
Sarbajit Das 30000 IT Hardware
Dipanjan Nagi 25000 IT Software

The expected output should be

Department          	Salary

IT Software 20000
IT Hardware 30000


Select Department, AVG(Salary) AS Salary
FROM tblTest
Group By Department
Order By Department DESC

Comments or Responses

Login to post response