SELECT e.emp_no, e.first_name, e.last_name, eb.btype, s.salary, 
CASE 
    WHEN eb.btype = 1 THEN ROUND(s.salary * 0.1, 1)
    WHEN eb.btype = 2 THEN ROUND(s.salary * 0.2, 1)
    ELSE ROUND(s.salary * 0.3, 1)
END AS bonus
FROM employees e
JOIN emp_bonus eb ON e.emp_no = eb.emp_no
JOIN salaries s ON e.emp_no = s.emp_no
WHERE s.to_date = '9999-01-01'
ORDER BY e.emp_no ASC;