SQL253 获取有奖金的员工 case when练习题

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

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

select e1.emp_no, e1.first_name, e1.last_name, e2.btype, s1.salary, 
case when e2.btype = 1 then s1.salary*0.1
when e2.btype = 2 then s1.salary*0.2 
else s1.salary*0.3 end bonus
from employees e1 join emp_bonus e2 
on e1.emp_no = e2.emp_no
join salaries s1 on e1.emp_no = s1.emp_no
where to_date = '9999-01-01'
order by e1.emp_no

语法:

case when 条件1 then 结果1

when 条件2 then 结果2

.。。。

else 其他结果 end 描述

全部评论

相关推荐

点赞 评论 收藏
分享
03-28 19:11
铜陵学院 C++
有礼貌的山羊追赶太阳:太典了,连笔试都没有开始就因为HC满了而结束了,而且还卡你不让你再投其他部门的。
点赞 评论 收藏
分享
评论
1
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务