题解 | #获取有奖金的员工相关信息。#
获取有奖金的员工相关信息。
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 新命名