超过经理收入的员工 表的自JOIN
2024-09-30 14:24:13
https://leetcode-cn.com/problems/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.
+----+-------+--------+-----------+
| 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 e.Name AS Employee FROM Employee e LEFT JOIN Employee eb ON e.ManagerId=eb.Id WHERE e.ManagerId IS NOT NULL AND e.Salary>eb.Salary;
最新文章
- Monthly Income Report – August 2016
- ABP(现代ASP.NET样板开发框架)主题线下交流会(上海)开始报名了!
- Java和.NET使用DES对称加密的区别
- asp.net web常用控件FileUpload(文件上传控件)
- JS实现打印功能
- codeforces 677A A. Vanya and Fence(水题)
- 封装的localstorge的插件,store.js
- 【jsp 分页】mysql limit方式进行分页
- node源码详解(六) —— 从server.listen 到事件循环
- MongoDB Sharding
- The Blocks Problem(vector)
- (Release Candidate)Candidate
- 在Debian系列Linux系统Ubuntu上安装配置yum的试验
- .net捕捉全局未处理异常的3种方式
- 常用socket选项
- Asp.net MVC 中Ajax的使用
- yaml语言在线可视化翻译
- DAY5 基本数据类型及内置方法
- string_01
- java.lang.AbstractMethodError: org.mybatis.spring.transaction.SpringManagedTransaction.getTimeout()L
热门文章
- Django-模型层(1)
- noi.ac NOIP2018 全国热身赛 第四场 T1 tree
- 洛谷 P1156 垃圾陷阱 谈论剪枝,非满分
- centos的那些小事儿!
- 【链表】2017多校训练三 HDU 6058 Kanade's sum
- 反编译sencha toucha打包的apk文件,修改应用名称支持中文以及去除应用标题栏
- XCode warning:“View Controller” is unreachable because it has no entry points
- 洛谷—— P1714 切蛋糕
- 如何使用google解决问题
- 51nod 1499 (最小割)