题解 | 获取员工其当前的薪水比其manager当前薪水还高的相关信息

获取员工其当前的薪水比其manager当前薪水还高的相关信息

https://www.nowcoder.com/practice/f858d74a030e48da8e0f69e21be63bef

with t1 as 
(
    select de.*,s.salary
    from dept_emp as de
    join salaries as s
    on de.emp_no = s.emp_no 

)
,t2 as
(
    select m.*,s.salary
    from dept_manager as m
    join salaries as s
    on m.emp_no = s.emp_no 

)
select t1.emp_no,t2.emp_no as manager_no,t1.salary as emp_salary,t2.salary as manager_salary
from t1,t2
where t1.dept_no = t2.dept_no 
and t1.salary > t2.salary 

t1员工的薪资,t2经理的薪资,通过dept_no建立连接关系

全部评论

相关推荐

评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务