题解 | #获取员工其当前的薪水比其

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

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

select
    table1.emp_no,
    table2.manager_no,
    table1.emp_salary,
    table2.manager_salary
from
    (
        select
            s.emp_no,
            de.dept_no,
            s.salary emp_salary
        from
            salaries s,
            dept_emp de
        where
            s.emp_no = de.emp_no
            and de.to_date = '9999-01-01'
    ) as table1
    inner join (
        select
            dm.emp_no as manager_no,
            dm.dept_no,
            s.salary as manager_salary
        from
            salaries s,
            dept_manager dm
        where
            s.emp_no = dm.emp_no
            and dm.to_date = '9999-01-01'
    ) table2 on table1.dept_no = table2.dept_no
    and table1.emp_no != table2.manager_no #从员工薪水表里排除经理薪水数据,(经理也是员工)
where
    table1.emp_salary > table2.manager_salary

全部评论

相关推荐

09-01 09:00
已编辑
四川旅游学院 运营
牛客55195891...:主要是专业不好,别的没毛病
牛客解忧铺
点赞 评论 收藏
分享
冷花幽露:大概率是了,京东面试就是这样。我上周一面也是20多分钟,面试官问的很刁钻的问题也答上来了,面完过了几天还是没推进,泡池子,昨天一看挂了。如果一面完第2天没有收到2面邀请,基本上不用抱希望了。如果你的bg是985,面试流程也是和我们一样,20多分钟,唯一区别就是面完他们会很快收到二面邮件,而不像我们泡池子然后挂掉
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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