LeeCode(Database)-Employees Earning More Than Their Managers
2015-07-27 11:10
489 查看
The
Given the
Employeetable 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
Employeetable, 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 | +----------+
# Write your MySQL query statement below SELECT a.NAME FROM Employee a, Employee b WHERE a.ManagerId = b.Id AND a.Salary > b.Salary;
相关文章推荐
- 【listview】pinned-section-listview应用 + 两种布局的listview
- Ubuntu14.04建立WIF热点供手机和平板上网
- iOS利用Runtime自定义控制器POP手势动画
- Java线程池
- RabbitMQ配置文件
- HDU 4278 - Faulty Odometer
- 电话薄
- JRTPLib的编译步骤
- Android面试宝典(一位优秀应届生面试经验,很多Android高阶问题)
- 面试题 ——— 二维数组的查找
- 编程经验
- 深入javascript: in 和 delete 运算符
- LeeCode(Database)-Combine Two Tables
- 运行该脚本出现/bin/sh^M: bad interpreter: No such file or directory
- 很好的客户端后台博客
- 【MYSQL】导入中文后乱码问题
- 使用fiddler修改请求和响应
- 如何在Eclipse中查看Java类库的源代码以及相应的api
- 获取手机屏幕的宽高
- 认识与入门 Markdown