“Cara Mendapatkan Gaji Maks di Setiap Departemen di SQL” Kode Jawaban

Dapatkan gaji maksimal dari setiap departemen SQL

--Find out the name of top earner in each departments
--Output has Name, Department name and max salary of the department

SELECT E.FIRST_NAME , D.DEPARTMENT_NAME, E.SALARY
FROM EMPLOYEES E
JOIN DEPARTMENTS D ON E.DEPARTMENT_ID = D.DEPARTMENT_ID
WHERE SALARY IN(SELECT MAX(E.SALARY)
FROM EMPLOYEES E
JOIN DEPARTMENTS D ON E.DEPARTMENT_ID = D.DEPARTMENT_ID
GROUP BY DEPARTMENT_NAME);
Obedient Ocelot

Cara Mendapatkan Gaji Maks di Setiap Departemen di SQL

SELECT firstname, MAX(salary)
FROM department d LEFT OUTER JOIN employee e
ON (d.department_id = e.department_id)
GROUP BY department_id; 
Obedient Ocelot

Cara Menemukan Gaji Max dan Min di SQL

SELECT MAX(SALARY) FROM EMPLOYEES
UNION
SELECT MIN(SALARY) FROM EMPLOYEES;
Obedient Ocelot

gaji maksimal kedua di SQL

SELECT MAX(SALARY) 'SECOND_MAX' FROM EMPLOYEES
WHERE SALARY <> (SELECT MAX(SALARY) FROM EMPLOYEES);
Obedient Ocelot

Jawaban yang mirip dengan “Cara Mendapatkan Gaji Maks di Setiap Departemen di SQL”

Pertanyaan yang mirip dengan “Cara Mendapatkan Gaji Maks di Setiap Departemen di SQL”

Lebih banyak jawaban terkait untuk “Cara Mendapatkan Gaji Maks di Setiap Departemen di SQL” di Sql

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya