欢迎光临散文网 会员登陆 & 注册

[database_leetcode]181. Employees Earning More Than Their Manage

2021-03-05 08:11 作者:您是打尖儿还是住店呢  | 我要投稿

The Employee table holds all employees including their managers. Every employee has an Id, and there is also a column for the manager Id.

employee

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      |


做个自联接即可;

问题属于简单类

select a.name Employee

from employee a join employee b 

on a.managerid=b.id

where a.salary>b.salary




[database_leetcode]181. Employees Earning More Than Their Manage的评论 (共 条)

分享到微博请遵守国家法律