---以下是自测sql代码
select e.emp_no
,e.first_name
,e.last_name
,b.btype
,s.salary
--计算bonus,条件判断btype,根据当前薪水计算bonus
,case b.btype
when '1' then s.salary*0.1
when '2' then s.salary*0.2
when '3' then s.salary*0.3
else 0 end
as bonus
from employees e
--联结奖金表,获取奖金类型信息
inner join emp_bonus b
on e.emp_no = b.emp_no
--链接薪水表,获取当前薪水信息
inner join salaries s
on e.emp_no=s.emp_no
--条件筛选前薪水表示to_date='9999-01-01'
where s.to_date='9999-01-01'



京公网安备 11010502036488号