[LeetCode] 181. Employees Earning More Than Their Managers_Easy tag: SQL
2024-10-19 22:37:13
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
最新文章
- Migrate Instance 操作详解 - 每天5分钟玩转 OpenStack(40)
- 崽崽帮www.zaizaibang.com精选3
- Error generating Swagger server (Python Flask) from Swagger editor
- python(二)拾遗
- corsproxy
- JMeter简单的性能测试实例
- 深入理解java虚拟机系列二——垃圾收集算法
- 0603 python 基础02
- RHEL部署ipa红帽身份验证
- JavaScript拼接html字符串时截断问题
- MAC Gradle 下载的问题
- 移植 iperf 网络性能测试工具到 Android-P
- Python 使用sys.exc_info自己捕获异常详细信息
- IOS初级:观察者
- linux内核分析第四周学习笔记
- RMAN备份与恢复实践(转)
- SSH pts 虚拟终端
- C++的四种初始化形式以及类型转换
- 开启Visual Studio 2013时,出现Microsoft.VisualStudio.Web.PasteJson.JsonPackage无法载入的可能解決方案
- java 优秀文章集锦
热门文章
- 【WEB前端开发最佳实践系列】JavaScript篇
- 本版本延续MVC中的统一验证机制~续的这篇文章,本篇主要是对验证基类的扩展和改善(转)
- Android studio Unable to start the daemon process
- Elasticsearch学习之多种查询方式
- tars环境部署
- Unity3D NGUI 二 NGUI Button怎样接受用户点击并调用函数,具体方法名称是什么
- html如何给图片加角标
- parent.relativePath' points at wrong local POM
- Centos6.5安装pip命令以及中途遇到的问题
- Mybatis批量insert报错的解决办法【the right syntax to use near '' at line...】