how to get max from each department in sql

Solutions on MaxInterview for how to get max from each department in sql by the best coders in the world

showing results for - "how to get max from each department in sql"
Ivanna
11 Oct 2019
1SELECT firstname, MAX(salary)
2FROM department d LEFT OUTER JOIN employee e
3ON (d.department_id = e.department_id)
4GROUP BY department_id; 
Ingrid
04 Nov 2020
1--Find out the name of top earner in each departments
2--Output has Name, Department name and max salary of the department
3
4SELECT E.FIRST_NAME , D.DEPARTMENT_NAME, E.SALARY
5FROM EMPLOYEES E
6JOIN DEPARTMENTS D ON E.DEPARTMENT_ID = D.DEPARTMENT_ID
7WHERE SALARY IN(SELECT MAX(E.SALARY)
8FROM EMPLOYEES E
9JOIN DEPARTMENTS D ON E.DEPARTMENT_ID = D.DEPARTMENT_ID
10GROUP BY DEPARTMENT_NAME);
queries leading to this page
sql query to find max salary from each departmentsql query get max salary each departmentsql return the max valueget max sum of salary from each department sqlfind out max salary between dept 3d 20 and 40sql queries for employee who have max salaryquery to get max salary of employee from each departmenthow to find maximum salary without using max function in sqlhow to get max value in sql maximum salary from each department sqlsql max salarysql select employee which have the max salary in a given departmentsql max salary of employeeget max salary from each department in sqlincrease salary who got max salary in sql queryhow to get max item in sqlhow to get max from each department in sqlget max salary from each department sqlhow to get max salary in each department in sqlwrite a sql query to find max salary and department name from each department who is the max salary getter for each department in sqlget top salary from each department in sqlsql sql query to get maximum salary in each departmentmax salary from each department in sqlget max salary from department sqlemployee with max salary sqlmax salary in sqlfind max salary from each departmentmax salary from each department sqlhow to get max value in sql column sql sql query to get maximum salary in each department from single tablemax salary in each department sqlhow to find highest salary in each department in sqlhow to get maximum salary of an employee in sql3 max salary in sqlselect employee with max salary in each department sqlmax salary by department sqlselect max salary from each department in sqlhow to get second highest salary in each department in sqltop salary from each department in sqlsql max salary by departmentsecond max salary in sqlmax salary employee all info in sqlfind max salary from each department in sqlhow to get 3 max salary in sqlhow to get max sales in sql from different tablefind max salary in sqlget max salary in sqlhighest salary in each department sqlget last max salary from each department sqlfind max salary and youngest employee in every department sqlsql maxsql query to find max salary of an employeehighest salary from each department in sqlfind max salary in each departmentwrite sql query to find max salary from each department 28print name and the max salary 29print max salary department wise in sqlsql highest salary in each departmentfind maximum salary in sqlmaximum salary in each department sqlhow to take one max from given states in sqlgetting maximum salary from each department the tables in each deoartment is differenthow to get maximum salary in sqlhow to find max salary in sqlhow to get max from each department in sql