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 |
+----------+ Code:
SELECT a.Name as Employee FROM Employee AS a, Employee AS b WHERE a.Salary > b.Salary AND a.ManangerID = b.Id 

最新文章

  1. Migrate Instance 操作详解 - 每天5分钟玩转 OpenStack(40)
  2. 崽崽帮www.zaizaibang.com精选3
  3. Error generating Swagger server (Python Flask) from Swagger editor
  4. python(二)拾遗
  5. corsproxy
  6. JMeter简单的性能测试实例
  7. 深入理解java虚拟机系列二——垃圾收集算法
  8. 0603 python 基础02
  9. RHEL部署ipa红帽身份验证
  10. JavaScript拼接html字符串时截断问题
  11. MAC Gradle 下载的问题
  12. 移植 iperf 网络性能测试工具到 Android-P
  13. Python 使用sys.exc_info自己捕获异常详细信息
  14. IOS初级:观察者
  15. linux内核分析第四周学习笔记
  16. RMAN备份与恢复实践(转)
  17. SSH pts 虚拟终端
  18. C++的四种初始化形式以及类型转换
  19. 开启Visual Studio 2013时,出现Microsoft.VisualStudio.Web.PasteJson.JsonPackage无法载入的可能解決方案
  20. java 优秀文章集锦

热门文章

  1. 【WEB前端开发最佳实践系列】JavaScript篇
  2. 本版本延续MVC中的统一验证机制~续的这篇文章,本篇主要是对验证基类的扩展和改善(转)
  3. Android studio Unable to start the daemon process
  4. Elasticsearch学习之多种查询方式
  5. tars环境部署
  6. Unity3D NGUI 二 NGUI Button怎样接受用户点击并调用函数,具体方法名称是什么
  7. html如何给图片加角标
  8. parent.relativePath' points at wrong local POM
  9. Centos6.5安装pip命令以及中途遇到的问题
  10. Mybatis批量insert报错的解决办法【the right syntax to use near '' at line...】