题解 | 统计各个部门平均薪资

select
    department,
    avg(实发薪资) avg_salary
from
    (
        select
            department,
            normal_salary - dock_salary 实发薪资
        from
            test.staff_tb st
            join test.salary_tb sat on st.staff_id = sat.staff_id
        where
            normal_salary - dock_salary between 4000 and 30000
    ) a
group by
    department
order by
    avg_salary desc

全部评论

相关推荐

07-16 17:55
门头沟学院 Java
点赞 评论 收藏
分享
06-02 15:53
阳光学院 Java
点赞 评论 收藏
分享
评论
1
收藏
分享

创作者周榜

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