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; 

最新文章

  1. Monthly Income Report – August 2016
  2. ABP(现代ASP.NET样板开发框架)主题线下交流会(上海)开始报名了!
  3. Java和.NET使用DES对称加密的区别
  4. asp.net web常用控件FileUpload(文件上传控件)
  5. JS实现打印功能
  6. codeforces 677A A. Vanya and Fence(水题)
  7. 封装的localstorge的插件,store.js
  8. 【jsp 分页】mysql limit方式进行分页
  9. node源码详解(六) —— 从server.listen 到事件循环
  10. MongoDB Sharding
  11. The Blocks Problem(vector)
  12. (Release Candidate)Candidate
  13. 在Debian系列Linux系统Ubuntu上安装配置yum的试验
  14. .net捕捉全局未处理异常的3种方式
  15. 常用socket选项
  16. Asp.net MVC 中Ajax的使用
  17. yaml语言在线可视化翻译
  18. DAY5 基本数据类型及内置方法
  19. string_01
  20. java.lang.AbstractMethodError: org.mybatis.spring.transaction.SpringManagedTransaction.getTimeout()L

热门文章

  1. Django-模型层(1)
  2. noi.ac NOIP2018 全国热身赛 第四场 T1 tree
  3. 洛谷 P1156 垃圾陷阱 谈论剪枝,非满分
  4. centos的那些小事儿!
  5. 【链表】2017多校训练三 HDU 6058 Kanade's sum
  6. 反编译sencha toucha打包的apk文件,修改应用名称支持中文以及去除应用标题栏
  7. XCode warning:“View Controller” is unreachable because it has no entry points
  8. 洛谷—— P1714 切蛋糕
  9. 如何使用google解决问题
  10. 51nod 1499 (最小割)