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

with tmp as (
select t1.*,t2.btype,t3.first_name,t3.last_name
from salaries as t1
inner join emp_bonus as t2 on t1.emp_no = t2.emp_no
inner join employees as t3 on t2.emp_no = t3.emp_no
where t1.to_date = '9999-01-01')

select 
emp_no
,first_name
,last_name
,btype
,salary
,case when btype = 1 then round(salary * 0.1,1) when btype = 2 then round(salary * 0.2,1) else 0.3*salary end as bonus
from tmp
order by emp_no asc;


全部评论

相关推荐

Twilight_mu:经典我朋友XXXX起手,这是那种经典的不知道目前行情搁那儿胡编乱造瞎指导的中年人,不用理这种**
点赞 评论 收藏
分享
刘湘_passion:太强了牛肉哥有被激励到
点赞 评论 收藏
分享
今天 13:40
武汉大学 Java
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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