I have a table containing attributes Id, Emp_name, dept_name, salary. Now i want to write an SQL query that will give me the dept_name value for which the overall salary of all employees belonging to that department is the highest, i.e dept for which sum of salaries of all its employees is the highest…? If there is any similar question with answer on stackoverflow, please suggest.. I dint find one. Thanks 🙂
I tried group by with sum() function, but i could not get how to find the maximum and compare it with sum.
Can you do