Practice Calculate Special Bonus
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
Tables: Employees(employee_id INT, name VARCHAR, salary INT). Employees.employee_id is unique. Return employee_id and bonus for every employee. The bonus equals salary only if employee_id is odd and name does not begin with M; otherwise it is 0. Order by employee_id ascending.
Source: Calculate Special Bonus on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
Input
Employees table: +-------------+---------+--------+ | employee_id | name | salary | +-------------+---------+--------+ | 2 | Meir | 3000 | | 3 | Michael | 3800 | | 7 | Addilyn | 7400 | | 8 | Juan | 6100 | | 9 | Kannon | 7700 | +-------------+---------+--------+
Output
+-------------+-------+ | employee_id | bonus | +-------------+-------+ | 2 | 0 | | 3 | 0 | | 7 | 7400 | | 8 | 0 | | 9 | 7700 | +-------------+-------+
Related LeetCode Problems
Practice more problems similar to Calculate Special Bonus.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.