leetcode

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

commit 53542dcab5d4a4410323c78d69d5a617b7892d8b
parent 96cd6902aed35f56bb94e696a1f750495e114e72
Author: AndrewLockVI <andrewlaack1@gmail.com>
Date:   Tue, 18 Jul 2023 18:04:03 -0500

Completed department highest salary using mysql

Diffstat:
Adepartment-highest-salary/department-highest-salary.sql | 11+++++++++++
1 file changed, 11 insertions(+), 0 deletions(-)

diff --git a/department-highest-salary/department-highest-salary.sql b/department-highest-salary/department-highest-salary.sql @@ -0,0 +1,11 @@ +--Find the highest salary based on +--department returning multiple if there +--are people with the same salary. +SELECT d.name AS Department, e.name AS Employee, e.Salary +FROM Employee e +INNER JOIN Department d ON e.departmentId = d.id +WHERE (e.departmentId, e.salary) IN ( + SELECT departmentId, MAX(salary) + FROM Employee + GROUP BY departmentId +);