资讯专栏INFORMATION COLUMN

[LeetCode] 181. Employees Earning More Than Their

ChanceWong / 1811人阅读

Problem

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
Solution
select e.Name as "Employee" from Employee e 
join Employee m 
on (e.ManagerId = m.Id) 
where e.Salary > m.Salary; 

文章版权归作者所有,未经允许请勿转载,若此文章存在违规行为,您可以联系管理员删除。

转载请注明本文地址:https://www.ucloud.cn/yun/32354.html

相关文章

  • 创建一种深思熟虑的文化

    摘要:问题是,他们有没有一种默认的文化或深思熟虑的文化这个不同就是计划与远见。没有一个强壮的为什么,对于如何创造一个强壮和深思熟虑的文化会很难。一种可以帮助简历并保持一种深思熟虑的文化的方式,是雇佣是同时考察技能与价值观。 原文: https://www.linkedin.com/wuko...翻译: 麦芽面包 在商业和咨询界文化最近变成了一个很火的话题。当你提到这个话题时每个人都会变得很...

    Keagan 评论0 收藏0
  • [Leetcode] Game of Life 生命游戏

    摘要:思路普通解法,遍历每一个细胞求值,用一个的矩阵存放结果。求值过程,稍微分析一下可知,其实就是按照以下的矩阵进行结果是可数的。 According to the Wikipedias article: The Game of Life, also knownsimply as Life, is a cellular automaton devised by the Britishmath...

    android_c 评论0 收藏0
  • [LeetCode] 289. Game of Life

    Problem According to the Wikipedias article: The Game of Life, also known simply as Life, is a cellular automaton devised by the British mathematician John Horton Conway in 1970. Given a board with m ...

    Ajian 评论0 收藏0
  • leetcode289. Game of Life

    摘要:板上的每个小格子有两种状态,或。而根据游戏规则,每一次这个板上的内容将会随着前一次板上的内容发生变化。然后再根据当前格子的状态计算当前格子的下一个状态。当然最后别忘了将原始状态传递出去。 题目要求 According to the Wikipedias article: The Game of Life, also known simply as Life, is a cellular...

    jerryloveemily 评论0 收藏0
  • [LintCode/LeetCode] Candy

    摘要:保证高的小朋友拿到的糖果更多,我们建立一个分糖果数组。首先,分析边界条件如果没有小朋友,或者只有一个小朋友,分别对应没有糖果,和有一个糖果。排排坐,吃果果。先往右,再往左。右边高,多一个。总和加上小朋友总数,就是要准备糖果的总数啦。 Problem There are N children standing in a line. Each child is assigned a rat...

    baishancloud 评论0 收藏0

发表评论

0条评论

最新活动
阅读需要支付1元查看
<