当前位置:网站首页>LeetCode-1873. Calculate special bonus
LeetCode-1873. Calculate special bonus
2022-06-12 06:23:00 【Border wanderer】
surface : Employees
+-------------+---------+
| Name | type |
+-------------+---------+
| employee_id | int |
| name | varchar |
| salary | int |
+-------------+---------+
employee_id It's the primary key of this table .
Each row of this table shows the employees id , Name and salary .
Write a SQL Query statement , Calculate the bonus for each employee . If an employee's id It's odd and his name doesn't start with 'M' start , Then his bonus is his salary 100%, Otherwise, the bonus is 0.
Return the result table ordered by employee_id.
For the returned result set, please follow employee_id Sort .
The query result format is shown in the following example :
Employees surface :
+-------------+---------+--------+
| employee_id | name | salary |
+-------------+---------+--------+
| 2 | Meir | 3000 |
| 3 | Michael | 3800 |
| 7 | Addilyn | 7400 |
| 8 | Juan | 6100 |
| 9 | Kannon | 7700 |
+-------------+---------+--------+
Result sheet :
+-------------+-------+
| employee_id | bonus |
+-------------+-------+
| 2 | 0 |
| 3 | 0 |
| 7 | 7400 |
| 8 | 0 |
| 9 | 7700 |
+-------------+-------+
Because employees id It's even , So employees id yes 2 and 8 The bonus for two of our employees is 0.
Employee id by 3 Because his name is 'M' start , therefore , Bonus is 0.
The other employees got a 100% bonus .
# Write your MySQL query statement below
SELECT employee_id ,
IF((employee_id % 2 = 0) OR (name LIKE 'M%'),0, salary) AS bonus
FROM Employees;边栏推荐
- (UE4 4.27) customize primitivecomponent
- Android studio mobile development creates a new database and obtains picture and text data from the database to display on the listview list
- Simulateur nightGod ADB View log
- JS变量作用域
- Word vector training based on nnlm
- About why GPU early-z reduces overdraw
- SQL 注入读写文件
- MNIST handwritten data recognition by CNN
- C2w model - language model
- IBL of directx11 advanced tutorial PBR (3)
猜你喜欢

摄像头拍摄运动物体,产生运动模糊/拖影的原因分析

MLP sensor
![How to increase heap size of JVM [duplicate] - how to increase heap size of JVM [duplicate]](/img/65/a214d137e230b1a1190feb03660f2c.jpg)
How to increase heap size of JVM [duplicate] - how to increase heap size of JVM [duplicate]

IBL of directx11 advanced tutorial PBR (3)

PHP一句话木马深度详细剖析

Explanation of sensor flicker/banding phenomenon

SQL 注入读写文件

线程有哪些状态?

. Net core - pass Net core will Net to cross platform

Overview of camera image quality
随机推荐
相机图像质量概述
C2w model - language model
LeetCode-219. Duplicate Element II present
How to increase heap size of JVM [duplicate] - how to increase heap size of JVM [duplicate]
Nodemon cannot load the file c:\users\administrator\appdata\roaming\npm\nodemon PS1, because script execution is prohibited in this system
Word vector training based on nnlm
Redis data type (VII) -- hyperloglog
LeetCode-419. Battleship on deck
Simulateur nightGod ADB View log
Open the camera in unity3d and display the contents of the camera in the scene as texture2d
MNIST handwritten data recognition by RNN
The unity3d script searches for colliders with overlaps within the specified radius
Automatic modeling of Interchange
Introduction to the method of diligently searching for the alliance procedure
Redis data structure (VIII) -- Geo
LeetCode-997. Find the town judge
单通道图片的读入
Multithreading mode (I) -- protective pause and join source code
LeetCode-1185. Day of the week
Unity3d display FPS script