You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
employee_id is the primary key (column with unique values) for this table.
20
+
Each row of this table indicates the employee ID, employee name, and salary.
21
+
22
+
Write a solution to calculate the bonus of each employee. The bonus of an employee is 100% of their salary if the ID of the employee is an odd number and the employee's name does not start with the character 'M'. The bonus of an employee is 0 otherwise.
23
+
24
+
Return the result table ordered by employee_id.
25
+
26
+
The result format is in the following example.
27
+
28
+
Example 1:
29
+
30
+
Input:
31
+
Employees table:
32
+
+-------------+---------+--------+
33
+
| employee_id | name | salary |
34
+
+-------------+---------+--------+
35
+
| 2 | Meir | 3000 |
36
+
| 3 | Michael | 3800 |
37
+
| 7 | Addilyn | 7400 |
38
+
| 8 | Juan | 6100 |
39
+
| 9 | Kannon | 7700 |
40
+
+-------------+---------+--------+
41
+
Output:
42
+
+-------------+-------+
43
+
| employee_id | bonus |
44
+
+-------------+-------+
45
+
| 2 | 0 |
46
+
| 3 | 0 |
47
+
| 7 | 7400 |
48
+
| 8 | 0 |
49
+
| 9 | 7700 |
50
+
+-------------+-------+
51
+
Explanation:
52
+
The employees with IDs 2 and 8 get 0 bonus because they have an even employee_id.
53
+
The employee with ID 3 gets 0 bonus because their name starts with 'M'.
0 commit comments