[LeetCode] 181. Employees Earning More Than Their Managers_Easy tag: SQL
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
[LeetCode] 181. Employees Earning More Than Their Managers_Easy tag: SQL的更多相关文章
- Leetcode 181. Employees Earning More Than Their Managers
The Employee table holds all employees including their managers. Every employee has an Id, and there ...
- leetcode 181 Employees Earning More Than Their Managers 不会分析的数据库复杂度
https://leetcode.com/problems/employees-earning-more-than-their-managers/description/ 老师上课没分析这些的复杂度, ...
- LeetCode 181. Employees Earning More Than Their Managers (超过经理收入的员工)
题目标签: 题目给了我们一个 员工表,包括经理.员工会有经理的id. 这里可以重复 利用两次 表格,表格a, 表格b,当a 员工的经理id 等于 b员工时候,在从中找到员工工资大于经理的.具体看co ...
- 【SQL】181. Employees Earning More Than Their Managers
The Employee table holds all employees including their managers. Every employee has an Id, and there ...
- 181. Employees Earning More Than Their Managers
The Employee table holds all employees including their managers. Every employee has an Id, and there ...
- [LeetCode] 513. Find Bottom Left Tree Value_ Medium tag: BFS
Given a binary tree, find the leftmost value in the last row of the tree. Example 1: Input: 2 / \ 1 ...
- [LeetCode] Employees Earning More Than Their Managers 员工挣得比经理多
The Employee table holds all employees including their managers. Every employee has an Id, and there ...
- LeetCode - Employees Earning More Than Their Managers
Description: The Employee table holds all employees including their managers. Every employee has an ...
- LeetCode——Employees Earning More Than Their Managers
The Employee table holds all employees including their managers. Every employee has an Id, and there ...
随机推荐
- 国内首款 FPGA 云服务器,性能是通用 CPU 服务器 30 倍以上
版权声明:本文由薛梁原创文章,转载请注明出处: 文章原文链接:https://www.qcloud.com/community/article/628340001485134638 来源:腾云阁 ht ...
- C#访问SQLServer数据库访问帮助类
SQLServer数据库访问帮助类 这里有一个Mysql帮助类的使用例子可以参考(大同小异) 写了一个Mysql的例子,SQLServer的差不多,一样的 C#简单三层结构设计UI.BLL.DAL 1 ...
- DOS 如何取当前时间做为文件名?
如果要取得以日期为文件名的文件,假设在命令行下键入date返回形式为:当前日期: 2005-06-02 星期四echo > %date:~0,4%%date:~5,2%%date:~8,2%~表 ...
- openstack-networking-neutron(三)---用户态和内核态的区别
究竟什么是用户态,什么是内核态,这两个基本概念以前一直理解得不是很清楚,根本原因个人觉得是在于因为大部分时候我们在写程序时关注的重点和着眼的角度放在了实现的功能和代码的逻辑性上,先看一个例子: 1)例 ...
- Python安装模块出错(No module named setuptools)解决方法
Python第三方模块中一般会自带setup.py文件,在Windows环境下,我们只需要在命令行中使用以下命令即可自动化安装 python setup.py install 安装的过程中有可能会出现 ...
- SDWebImage第三方库使用注意的一些问题
1.利用"UIImageView+WebCache.h"加载图片数据 例如: UIImage *placeHolderImg = [UIImage imageNamed:@&quo ...
- python之traceback
traceback 模块允许你在程序里打印异常的跟踪返回 (Traceback)信息 1.1 traceback.print_exc() File: traceback-example-1.py # ...
- HTML5是什么?如何鉴定HTML5产品?[转]
转自:http://www.jscode.cn/web/v62484 Html 5开始大热标志性的事件是Apple 前CEO Steve Jobs 公开炮轰Flash,并指出Flash在移动终端的不利 ...
- 基于pandas python的美团某商家的评论销售数据分析(可视化)
基于pandas python的美团某商家的评论销售数据分析 第一篇 数据初步的统计 本文是该可视化系列的第二篇 第三篇 数据中的评论数据用于自然语言处理 导入相关库 from pyecharts i ...
- Flask详解
Flask是一个基于Python开发并且依赖jinja2模板和Werkzeug WSGI服务的一个微型框架,对于Werkzeug本质是Socket服务端,其用于接收http请求并对请求进行预处理,然后 ...