方法)CASE WHEN 求出bonus
- 给出emp_no、first_name、last_name、奖金类型btype、对应的当前薪水情况salary以及奖金金额bonus
- bonus类型btype为1其奖金为薪水salary的10%,btype为2其奖金为薪水的20%,其他类型均为薪水的30%
- 当前薪水表示to_date='9999-01-01'
SELECT e.emp_no, e.first_name, e.last_name, eb.btype, s.salary, CASE WHEN eb.btype = 1 THEN s.salary * 0.1 WHEN eb.btype = 2 THEN s.salary * 0.2 ELSE s.salary * 0.3 END bonus FROM emp_bonus AS eb, employees AS e, salaries AS s WHERE eb.emp_no = e.emp_no AND s.emp_no = e.emp_no AND s.to_date='9999-01-01';