题解 | 获取有奖金的员工相关信息。
获取有奖金的员工相关信息。
https://www.nowcoder.com/practice/5cdbf1dcbe8d4c689020b6b2743820bf
select
e.emp_no,
first_name,
last_name,
btype,
salary,
(
case btype
when 1 then round(0.1*salary,1)
when 2 then round(0.2*salary,1)
else round(0.3*salary,1)
end
) as bonus
from
employees e
inner join emp_bonus eb on e.emp_no = eb.emp_no
inner join salaries s on e.emp_no = s.emp_no
where to_date = '9999-01-01'
order by e.emp_no asc
