Write a SQL Query to find Max salary from each department.

Given a Employee table with three columns
ID, Salary, DeptID
10, 1000, 2
20, 5000, 3
30, 3000, 2


We can first use group by DeptID on Employee table and then get the Max salary from each Dept group.

SELECT DeptID, MAX(salary)
FROM Employee

Read the full book at www.amazon.com
Posted in SQL, SQL Interview Questions

Leave a Reply

Your email address will not be published. Required fields are marked *