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

获取员工其当前的薪水比其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

全部评论

相关推荐

神哥不得了:首先我就是在成都,成都的互联网格外的卷,如果是凭现在的简历的话很难找到大厂,建议再添加一个高质量的项目上去,另外专业技能的话最好是超过每一条的一半
点赞 评论 收藏
分享
Cassifa:发的字比你都多的一律视为骗子或者想白嫖压榨实习生的
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务