[LeetCode]577. Employee Bonus 员工奖金
Select all employee's name and bonus whose bonus is < 1000.
Table:Employee
+-------+--------+-----------+--------+
| empId | name | supervisor| salary |
+-------+--------+-----------+--------+
| 1 | John | 3 | 1000 |
| 2 | Dan | 3 | 2000 |
| 3 | Brad | null | 4000 |
| 4 | Thomas | 3 | 4000 |
+-------+--------+-----------+--------+
empId is the primary key column for this table.
Table: Bonus
+-------+-------+
| empId | bonus |
+-------+-------+
| 2 | 500 |
| 4 | 2000 |
+-------+-------+
empId is the primary key column for this table.
Example ouput:
+-------+-------+
| name | bonus |
+-------+-------+
| John | null |
| Dan | 500 |
| Brad | null |
+-------+-------+
选出所有奖金<1000元的雇员姓名及奖金数额
解法1:
# Write your MySQL query statement below
SELECT name, bonus
FROM Employee LEFT JOIN Bonus USING (empId)
WHERE IFNULL(bonus, 0) < 1000
解法2:
select name, bonus
from
Employee e left join Bonus b
on e.empId = b.empId
where bonus < 1000 or bonus is null
All LeetCode Questions List 题目汇总
[LeetCode]577. Employee Bonus 员工奖金的更多相关文章
- 【leetcode_easy_$】577. Employee Bonus
problem 577. Employee Bonus 参考 1. Leetcode_easy_$_577. Employee Bonus; 2. https://www.cnblogs.com/li ...
- [LeetCode] 577. Employee Bonus_Easy tag: SQL
Select all employee's name and bonus whose bonus is < 1000. Table:Employee +-------+--------+---- ...
- 解题报告 - 577. Employee Bonus
Select all employee's name and bonus whose bonus is < 1000. Table:Employee +-------+--------+---- ...
- [LeetCode]690. Employee Importance员工重要信息
哈希表存id和员工数据结构 递归获取信息 public int getImportance(List<Employee> employees, int id) { Map<Integ ...
- [SQL]LeetCode577.员工奖金 | Employee Bonus
Select all employee's name and bonus whose bonus is < 1000. Table:Employee +-------+--------+---- ...
- [LeetCode] Employee Importance 员工重要度
You are given a data structure of employee information, which includes the employee's unique id, his ...
- LeetCode 690. Employee Importance (职员的重要值)
You are given a data structure of employee information, which includes the employee's unique id, his ...
- Leetcode690.Employee Importance员工的重要性
给定一个保存员工信息的数据结构,它包含了员工唯一的id,重要度 和 直系下属的id. 比如,员工1是员工2的领导,员工2是员工3的领导.他们相应的重要度为15, 10, 5.那么员工1的数据结构是[1 ...
- LeetCode - 690. Employee Importance
You are given a data structure of employee information, which includes the employee's unique id, his ...
随机推荐
- Codeforces G. Nick and Array(贪心)
题目描述: Nick had received an awesome array of integers a=[a1,a2,…,an] as a gift for his 5 birthday fro ...
- 函数式编程之pipeline——很酷有没有
Pipeline pipeline 管道借鉴于Unix Shell的管道操作——把若干个命令串起来,前面命令的输出成为后面命令的输入,如此完成一个流式计算.(注:管道绝对是一个伟大的发明,他的设哲学就 ...
- js 函数的this指向
一. 1.es5: 函数里的this指向分两种,一种正常函数调用指向被调用的对象,比如: test=()=>{ console.log(this) }; test();//是当前window调用 ...
- dimensionality reduction动机---data compression(使算法提速)
data compression可以使数据占用更少的空间,并且能使算法提速 什么是dimensionality reduction(维数约简) 例1:比如说我们有一些数据,它有很多很多的feat ...
- Vue移动端项目如何使用手机预览调试
- (3) esp8266 官方库文件,没有求逆函数
下载库文件 #include <MatrixMath.h> #define N (2) mtx_type A[N][N]; mtx_type B[N][N]; mtx_type C[N][ ...
- 洛谷 P2341 [HAOI2006]受欢迎的牛 题解
今天学了强连通分量的Tarjan算法,做了这道类似于板子题的题(尽管我调了1.5h).主要的思路是用Tarjan缩点之后,求每个点的入度(实际上是出度,因为我是反着连边的).如果 有且只有一个点的入度 ...
- 初版javascript的思维导图
- WinDbg常用命令系列---|(进程状态)
|(进程状态) 简介 (|) 命令显示指定进程的状态或当前正在调试你的所有进程. 使用形式 | Process 参数 Process 指定要显示的进程. 如果省略此参数,将显示所有正在调试的进程. 支 ...
- something about 乘法逆元
before 在求解除法取模问题(a / b) % m时,我们可以转化为(a % (b * m)) / b, 但是如果b很大,则会出现爆精度问题,所以我们避免使用除法直接计算. (逆元就像是倒数一样的 ...