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

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

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

select sa.emp_no, first_name, last_name, btype, salary, case btype when 1 then round(salary*0.1,1) when 2 then round(salary*0.2,1) else round (salary*0.3,1) end as bonus
from salaries sa join emp_bonus bon on sa.emp_no = bon.emp_no
join employees em on sa.emp_no = em.emp_no
where to_date = '9999-01-01'
order by sa.emp_no

case 被判断的字段名 when 1 then 1 when 2 then 2 else 3 end as 新命名

全部评论

相关推荐

ldf李鑫:不说公司名祝你以后天天遇到这样的公司
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务