Department Highest Salary


  • 0

    Click here to see the full article post


  • 0
    D

    select t2.Name as Department, t1.Name as Employee, t1.Salary
    from Employee as t1, Department as t2
    where t1.DepartmentId = t2.Id
    and (t1.DepartmentId , t1.Salary) in (
    select DepartmentId , max(salary) as Salary
    from Employee
    group by DepartmentId
    )


  • 0
    G

    Write your MySQL query statement below

    select d.Name as 'Department', e.Name as 'Employee', e.Salary
    from Employee e join Department d on d.Id = e.DepartmentId
    where 1>(
    select count(distinct e2.Salary) from Employee e2
    where e2.Salary > e.Salary and e2.DepartmentId = e.DepartmentId
    )
    ;


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.