commit d198454f34a268b9ad3993235797e04165e1ec23 parent 7eb314699d624efe9643cc6cd675503932745f71 Author: AndrewLockVI <andrewlaack1@gmail.com> Date: Sat, 15 Jul 2023 20:19:30 -0500 Completed calculate special bonus using mySQL Diffstat:
| A | calculate-special-bonus/special-bonus.sql | | | 10 | ++++++++++ |
1 file changed, 10 insertions(+), 0 deletions(-)
diff --git a/calculate-special-bonus/special-bonus.sql b/calculate-special-bonus/special-bonus.sql @@ -0,0 +1,10 @@ +--Calculate the employee bonuses where it is 0 if they are either even or have an M at the start of their name +--otherwise it is their salary. +SELECT Employees.employee_id, +CASE + WHEN Employees.employee_id % 2 = 1 AND SUBSTRING(Employees.name , 1, 1) != 'M' THEN Employees.salary + ELSE 0 +END +AS bonus +FROM Employees +ORDER BY Employees.employee_id