⌘K
Flycodx

Employees Earning More Than Manager

Employees Earning More Than Manager

EasySQL0% accepted

Given an Employee table with Id, Name, Salary, ManagerId - find all employees who earn more than their manager.

Approach

Find employees earning more than their direct manager using self-join.

Input

Employee: [(1,Joe,70000,3),(2,Henry,80000,4),(3,Sam,60000,NULL),(4,Max,90000,NULL)]

Output

Joe (70000 > Sam 60000)

Scenarios & Expected Answers

Sign in to continue

Create a free account to view answers and mark progress.

  • Free forever — no credit card
  • Theory Q&A with detailed answers
  • Points, streaks & leaderboards
Auto Save On