学习时间:
2023年1月28日
题目描述:
题解分享:
# 作 者 : 繁 华 倾 夏
# 力扣(LeetCode):1873. 计算特殊奖金
# MySQL 数据库
# Write your MySQL query statement below
select employee_id,
(case when mod(employee_id, 2) != 0 and left(name, 1) != 'M' then salary
when mod(employee_id, 2) = 0 or left(name, 1) = 'M' then 0
end) bonus
from employees
order by employee_id
# select employee_id,
# if(mod(employee_id,2)!=0 and left(name,1)!='M',salary,0) bonus
# from employees
# order by employee_id