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 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
The detailed ... View full answer
Get step-by-step solutions from verified subject matter experts
