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. iscsi线缆

  2. firewalled centos7

    zone绑定网卡 firewall-cmd --zone=internal --add-interface=ens192 --permanent firewall-cmd --permanent -- ...

  3. json拼接转义符

    //转义符替 function escapeReplace(Str) { var newStrJson = Str.replace(/\%/g, "%25"); newStrJso ...

  4. 分享10个原生JavaScript技巧

    首先在这里要非常感谢无私分享作品的网友们,这些代码片段主要由网友们平时分享的作品代码里面和经常去逛网站然后查看源文件收集到的.把平时网站上常用的一些实用功能代码片段通通收集起来,方便网友们学习使用,利 ...

  5. Error -27740: WSA_IO_pending

    Error -27740: WSA_IO_pendingAction.c(198): Error -27791: Server **** has shut down the connection pr ...

  6. http的GET和POST

    本文主要内容 1.  GET和POST方法介绍 2.  源代码分析 3.  结果分析 4.  例子参考及引用: http://www.cnblogs.com/zhijianliutang/archiv ...

  7. Spring 4 官方文档学习(十)数据访问之DAO支持

    1.介绍 Spring 中 Data Access Object (DAO)支持 的目标是以一种一致的方式更简单的使用JDBC.Hibernate.JPA或JDO等数据访问技术.可以在前面说的几种数据 ...

  8. 控制反转是Spring框架的核心。

    早在2004年,Martin Fowler就提出了“哪些方面的控制被反转了?”这个问题.他总结出是依赖对象的获得被反转了.基于这个结论,他为控制反转创造了一个更好的名字:依赖注入.许多非凡的应用(比H ...

  9. ffplay(2.0.1)中的音视频同步

    最近在看ffmpeg相关的一些东西,以及一些播放器相关资料和代码. 然后对于ffmpeg-2.0.1版本下的ffplay进行了大概的代码阅读,其中这里把里面的音视频同步,按个人的理解,暂时在这里作个笔 ...

  10. R语言低级绘图函数-text

    text函数用来在一张图表上添加文字,只需要指定对应的x和y坐标,以及需要添加的文字内容就可以了 基本用法: plot(1:5, 1:5, xlim = c(0,6), ylim = c (0,6), ...