100-Days-of-LeetCode

Practicing my coding skills by solving LeetCode problems everyday.

View on GitHub

/**
  Problem Name : Employees Earning More Than Their Managers
  Problem URL : https://leetcode.com/problems/employees-earning-more-than-their-managers/
  Description :
     write a SQL query that finds out employees who earn more than their managers. 
     For the above table, Joe is the only employee who earns more than his manager.
  Difficulty : Easy
  Language : Oracle SQL
  Category : Database
 
*/

SELECT emp.Name "Employee"
FROM Employee emp,
     Employee manager 
WHERE emp.ManagerId = manager.Id 
AND emp.Salary > manager.Salary;