题解 | #获取有奖金的员工相关信息。#

获取有奖金的员工相关信息。

https://www.nowcoder.com/practice/5cdbf1dcbe8d4c689020b6b2743820bf

select 
b.emp_no,
e.first_name, 
e.last_name, 
b.btype,
s.salary,
case when b.btype=1 then s.salary*0.1
    when b.btype=2 then s.salary*0.2
    else s.salary*0.3 end as bonus
from employees e
join (select emp_no, salary, from_date, to_date from salaries s
where to_date='9999-01-01') s
join emp_bonus b
on e.emp_no=s.emp_no
and  e.emp_no=b.emp_no
and b.recevied between s.from_date and s.to_date
# group by emp_no
order by emp_no

全部评论

相关推荐

点赞 评论 收藏
分享
09-01 09:00
已编辑
四川旅游学院 运营
牛客55195891...:主要是专业不好,别的没毛病
牛客解忧铺
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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