Leetcode Note: MySQL - Calculate Special Bonus

Calculate Special Bonus - LeetCode
https://leetcode.com/problems/calculate-special-bonus/

  • MySQL で取り組んだメモ

回答

📌 ✅ [MYSQL] Simple Solution With If Condition - Calculate Special Bonus - LeetCode
https://leetcode.com/problems/calculate-special-bonus/solutions/2264587/mysql-simple-solution-with-if-condition/

select 
    employee_id,
    if(employee_id%2!=0 and name NOT LIKE 'M%',salary,0) as bonus 
from Employees 
order by employee_id