Find Department With Highest Average Salary
Find the department with the highest average salary.
sql
SELECT department_name, AVG(salary) AS average_salary FROM employees GROUP BY department_name ORDER BY average_salary DESC LIMIT 1;
This query calculates the average salary for each department, sorts the results in descending order, and returns the top record representing the department with the highest average salary.
PromptDB can make mistakes. Please double-check responses.