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.

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

选出比经理工资高的员工名字

思路是表的自身连接

# Write your MySQL query statement below
select first.Name from Employee first, Employee second
where first.ManagerId=second.Id and first.Salary > second.Salary;

LeetCode - Employees Earning More Than Their Managers的更多相关文章

  1. [LeetCode] Employees Earning More Than Their Managers 员工挣得比经理多

    The Employee table holds all employees including their managers. Every employee has an Id, and there ...

  2. LeetCode——Employees Earning More Than Their Managers

    The Employee table holds all employees including their managers. Every employee has an Id, and there ...

  3. Leetcode 181. Employees Earning More Than Their Managers

    The Employee table holds all employees including their managers. Every employee has an Id, and there ...

  4. leetcode 181 Employees Earning More Than Their Managers 不会分析的数据库复杂度

    https://leetcode.com/problems/employees-earning-more-than-their-managers/description/ 老师上课没分析这些的复杂度, ...

  5. LeetCode 181. Employees Earning More Than Their Managers (超过经理收入的员工)

    题目标签: 题目给了我们一个 员工表,包括经理.员工会有经理的id. 这里可以重复 利用两次 表格,表格a, 表格b,当a 员工的经理id  等于 b员工时候,在从中找到员工工资大于经理的.具体看co ...

  6. LeetCode SQL:Employees Earning More Than Their Managers

    # Write your MySQL query statement below SELECT a.Name FROM Employee AS a INNER JOIN Employee AS b O ...

  7. [SQL]LeetCode181. 超过经理收入的员工 | Employees Earning More Than Their Managers

    SQL架构 Create table If Not Exists Employee (Id ), Salary int, ManagerId int) Truncate table Employee ...

  8. LeeCode(Database)-Employees Earning More Than Their Managers

    The Employee table holds all employees including their managers. Every employee has an Id, and there ...

  9. 【SQL】181. Employees Earning More Than Their Managers

    The Employee table holds all employees including their managers. Every employee has an Id, and there ...

随机推荐

  1. Android Activity动画属性简介

    Android Activity动画属性简介 在Android当中 设置activity的动画 需要复写 android:windowAnimationStyle这个属性 我们自定义一个动画样式来继承 ...

  2. VMWare虚拟机安装创建虚拟机的使用教程

    VMWare虚拟机安装创建虚拟机的使用教程   在配置虚拟机之前需要安装它,VMWare软件的安装过程比较简单,在安装在之前应该先看下说明文档.下面以VMWare Workstation6.5虚拟机 ...

  3. hive thrift 开机启动

    这个问题困扰我很久,之前redis的时候,也出现了这个问题,从网上找的thrift脚本没有一个好使的,最后通过修改/etc/rc.d/rc.local来执行一些非服务的命令,这样子就不需要像写服务那样 ...

  4. catalina.home和catalina.base这两个属性的作用

    catalina.home和catalina.base这两个属性仅在你需要安装多个Tomcat实例而不想安装多个软件备份的时候使用,这样能节省磁盘空间.以Tomcat6.0为例,其Tomcat目录结构 ...

  5. Timsort 算法

    转载自:http://blog.csdn.net/yangzhongblog/article/details/8184707 Timsort是结合了合并排序(merge sort)和插入排序(inse ...

  6. JavaScript 中,num = num || 1 这种写法有哪些优缺点?

    语法糖,等价于 if(!!num === false) num=1; 类似于java的 num=null ? 1 : num 以下是来自某位知友的解答: 就是个简写法而已.好处就是短一点,但是其实坏处 ...

  7. repo 安装

    repo是android用于管理git仓库的工具. 参考链接 http://www.cnblogs.com/xiaoerlang/p/3549156.html mkdir ~/bin export P ...

  8. IoC就是IoC,不是什么技术,与GoF一样,是一种 设计模式。

    IoC就是IoC,不是什么技术,与GoF一样,是一种 设计模式. Interface Driven Design接口驱动,接口驱动有很多好处,可以提供不同灵活的子类实现,增加代码稳定和健壮性等等,但是 ...

  9. Global.asax中使用HttpContext为空

    application启动的时候并没有对应的HttpContext.Current请求所以会出错 用System.Web.Hosting.HostingEnvironment.MapPath就可以了

  10. git 分支的创建、合并、删除

          基本概念与命令 分支(branch):每次提交,Git都把提交的内容串成一条时间线,这条时间线就是一个分支 .   git 分支的创建 git branch branchName git ...