select
t.emp_no,
t2.first_name,
t2.last_name,
t1.btype,
t.salary,
case when t1.btype=1 then t.salary*0.1
     when t1.btype=2 then t.salary*0.2
     else t.salary*0.3 end bonus
from salaries t
right join emp_bonus t1
on t.emp_no=t1.emp_no
left join employees t2
on t.emp_no=t2.emp_no
where t.to_date='9999-01-01'
order by t.emp_no