题目描述
leetcode题目:1873. 计算特殊奖金
Code
写法一: CASE WHEN
select employee_id,
(case when employee_id % 2 = 0 or name like 'M%' then salary = 0 else salary end) as bonus
from Employees
order by employee_id
写法二 :IF()
select employee_id,
if(employee_id % 2 = 0 or name like 'M%', 0, salary) as bonus
from Employees
order by employee_id