[LeetCode] 181、超过经理收入的员工

题目描述

Employee 表包含所有员工,他们的经理也属于员工。每个员工都有一个 Id,此外还有一列对应员工的经理的 Id。给定 Employee 表,编写一个 SQL 查询,该查询可以获取收入超过他们经理的员工的姓名。

解题思路

一只猪的解题思路

select a.name as Employee
from employee as a inner join employee as b on a.managerid = b.id
where a.salary > b.salary
发布了386 篇原创文章 · 获赞 576 · 访问量 15万+

猜你喜欢

转载自blog.csdn.net/ft_sunshine/article/details/103808462