当前位置:网站首页>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;边栏推荐
- 468. verifying the IP address
- Qt-- realize TCP communication
- Storing texture2d to hard disk JPG file with script under unity3d
- The first principle of thinking method
- Video fire detection based on Gaussian mixture model and multi-color
- SQL 注入-盲注
- 夜神模拟器adb查看log
- Get the size of the picture
- sqlite交叉編譯動態庫
- . Net core and Net framework comparison
猜你喜欢

Houdini & UE4 programmed generation of mountains and multi vegetation scattering points

SQL 注入读写文件

Nocturnal simulator ADB view log

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

Leetcode January 13 daily question 747 At least twice the maximum number of other numbers

Getting started with houdininengine HDA and UE4

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

PHP 读写 COOKIE

cv2.fillPoly coco annotator segment坐标转化为mask图像

使用 ms17-010 永恒之蓝漏洞对 win7 进行渗透及建立永久后门
随机推荐
LeetCode-1154. Day of the year
AI作业ch8
Explanation of sensor flicker/banding phenomenon
Unity3d display FPS script
Redis queue
LeetCode-419. Battleship on deck
SQLite cross compile dynamic library
Poisson disk sampling for procedural placement
MLP sensor
Houdini & UE4 programmed generation of mountains and multi vegetation scattering points
Leetcode January 12 daily question 334 Increasing ternary subsequence
Piecewise Bezier curve
LeetCode-剑指Offer(第二版)个人题解完整版
分段贝塞尔曲线
468. verifying the IP address
Touch screen setting for win7 system dual screen extended display
Multithreading (2) -- pipeline (4) -- Park and unpark
(UE4 4.27) add globalshder to the plug-in
C2w model - language model
Unreal Engine learning notes