LeetCode OJ Employees Earning More Than Their Managers

The Employee table holds all employees including their managers. Every employee
has an Id, and there is also a column for the manager Id.

+----+-------+--------+-----------+
| Id | Name  | Salary | ManagerId |
+----+-------+--------+-----------+
| 1  | Joe   | 70000  | 3         |
| 2  | Henry | 80000  | 4         |
| 3  | Sam   | 60000  | NULL      |
| 4  | Max   | 90000  | NULL      |
+----+-------+--------+-----------+

Given the Employee table, 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.

+----------+
| Employee |
+----------+
| Joe      |
+----------+
 select a.name as Employee from Employee a, Employee b where a.managerid = b.id and a.salary > b.salary;
时间: 2024-10-10 13:28:21

LeetCode OJ Employees Earning More Than Their Managers的相关文章

leetcode 181. Employees Earning More Than Their Managers

题目链接: https://leetcode.com/problems/employees-earning-more-than-their-managers/ The Employee table holds all employees including their managers. Every employee has an Id, and there is also a column for the manager Id. +----+-------+--------+---------

【Leetcode】Employees Earning More Than Their Managers

题目链接:https://leetcode.com/problems/employees-earning-more-than-their-managers/ 题目: The Employee table holds all employees including their managers. Every employee has an Id, and there is also a column for the manager Id. +--+---+--–+---–+ | Id | Name

LeetCode SQL:Employees Earning More Than Their Managers

# Write your MySQL query statement below SELECT a.Name FROM Employee AS a INNER JOIN Employee AS b ON a.ManagerId = b.Id WHERE a.Salary > b.Salary 让我来看看讨论区,并没有发现更好的

LeetCode:Employees Earning More Than Their Manager

1.题目名称 Employees Earning More Than Their Managers(比领导工资还高的员工) 2.题目地址 https://leetcode.com/problems/employees-earning-more-than-their-managers/ 3.题目内容 Employee表的结构包含四列:Id.Name.Salary.ManagerId,找出其中工资高于直接上级的员工的Name. 例如,下表中Joe的工资大于他的直接上级Sam: +----+-----

[LeetCode] Employees Earning More Than Their Managers 员工挣得比经理多

The Employee table holds all employees including their managers. Every employee has an Id, and there is also a column for the manager Id. +----+-------+--------+-----------+ | Id | Name | Salary | ManagerId | +----+-------+--------+-----------+ | 1 |

【leetcode SQL】Employees Earning More Than Their Managers

The Employee table holds all employees including their managers. Every employee has an Id, and there is also a column for the manager Id. +----+-------+--------+-----------+ | Id | Name | Salary | ManagerId | +----+-------+--------+-----------+ | 1 |

LeetCode - Employees Earning More Than Their Managers

Description: The Employee table holds all employees including their managers. Every employee has an Id, and there is also a column for the manager Id. Given the Employee table, write a SQL query that finds out employees who earn more than their manag

[LeetCode]Employees Earning More Than Their Managers,解题报告

目录 目录 题目 思路 AC SQL 题目 The Employee table holds all employees including their managers. Every employee has an Id, and there is also a column for the manager Id. Id Name Salary ManagerId 1 Joe 70000 3 2 Henry 80000 4 3 Sam 60000 NULL 4 Max 90000 NULL G

Employees Earning More Than Their Managers Leetcode SQL

The Employee table holds all employees including their managers. Every employee has an Id, and there is also a column for the manager Id. +----+-------+--------+-----------+ | Id | Name  | Salary | ManagerId | +----+-------+--------+-----------+ | 1