题解 | 获取有奖金的员工相关信息。
select e.emp_no,e.first_name,e.last_name,em.btype,s.salary, case when em.btype=1 then 0.1*s.salary when em.btype=2 then 0.2*s.salary else s.salary *0.3 end bonus from employees e join emp_bonus em on e.emp_no=em.emp_no join salaries s on s.emp_no=e.emp_no where to_date='9999-01-01' #一个非常典型的用case when 的例子
查看11道真题和解析