题解 | #查找在职员工自入职以来的薪水涨幅情况#

查找在职员工自入职以来的薪水涨幅情况

http://www.nowcoder.com/practice/fc7344ece7294b9e98401826b94c6ea5

考点:多层select/join

  • ps:提交四次没过的原因居然是没有order by,气!qwq
select w1.emp_no1 as emp_no, (salary2-salary1) as growth from (select e.emp_no as emp_no1, s.salary as salary1 from employees e left join salaries s
 on e.emp_no = s.emp_no
where e.hire_date = s.from_date
group by e.emp_no) as w1 inner join 
(select e.emp_no as emp_no2, s.salary as salary2 from salaries s left join employees e
 on e.emp_no = s.emp_no
where to_date = '9999-01-01'
group by e.emp_no) as w2 on w1.emp_no1 = w2.emp_no2
order by growth
全部评论

相关推荐

11-30 11:07
河南大学 Java
宇宙厂 测开 n*15
丘丘给个offer:有后选后
点赞 评论 收藏
分享
把球:这个听过,你加了就会发现是字节的hr
点赞 评论 收藏
分享
点赞 评论 收藏
分享
评论
点赞
收藏
分享
牛客网
牛客企业服务