Question: Write a SQL query to find the average salary of employees in each department, sorted in descending order by the average salary. Example: Input:

Write a SQL query to find the average salary of employees in

Write a SQL query to find the average salary of employees in each department, sorted in descending order by the average salary. Example: Input: Employee table: name John Jane Bob Alice Tim Output: department IT HR Query: department IT HR IT HR IT average salary 2000 2000 SELECT department, AVG(salary) AS average salary FROM Employee GROUP BY department ORDER BY average salary DESC salary 1000 1500 2000 2500 3000 Copy code

Step by Step Solution

3.47 Rating (154 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

The detailed ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!