My answer to the question


  • 0
    K
    select d1.Name as Department,e1.Name as Employee,Salary from Department d1,Employee e1 
     where e1.DepartmentId=d1.Id and salary>all(
    select salary from Employee e2 where d1.Id=e2.DepartmentId and e1.Id!=e2.Id and e1.salary!=e2.salary);

  • 0
    C

    select A.Name as Department, B.Name as Employee, B.Salary
    from Employee B join Department A on A.Id = B.DepartmentId
    where 1 > (select count(distinct C.Salary)
    from Employee C
    where C.Salary>B.Salary AND C.DepartmentId = B.DepartmentId
    );

    similar one


Log in to reply
 

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