[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 ...
随机推荐
- Manthan, Codefest 19 (open for everyone, rated, Div. 1 + Div. 2)-D. Restore Permutation-构造+树状数组
Manthan, Codefest 19 (open for everyone, rated, Div. 1 + Div. 2)-D. Restore Permutation-构造+树状数组 [Pro ...
- scrapy框架爬取智联招聘网站上深圳地区python岗位信息。
爬取字段,公司名称,职位名称,公司详情的链接,薪资待遇,要求的工作经验年限 1,items中定义爬取字段 import scrapy class ZhilianzhaopinItem(scrapy.I ...
- PySpark 的背后原理--在Driver端,通过Py4j实现在Python中调用Java的方法.pyspark.executor 端一个Executor上同时运行多少个Task,就会有多少个对应的pyspark.worker进程。
PySpark 的背后原理 Spark主要是由Scala语言开发,为了方便和其他系统集成而不引入scala相关依赖,部分实现使用Java语言开发,例如External Shuffle Service等 ...
- C# 退出应用程序的几种方法
Application.Exit();//好像只在主线程可以起作用,而且当有线程,或是阻塞方法的情况下,很容易失灵 this.Close();//只是关闭当前窗体. Application.ExitT ...
- redis node 常用命令
命令窗口 flushall //清空全库 keys * //查看所有 HMSET user1 name liujinyu age 25 //哈希 添加多个值 HSET user1 sex man // ...
- fastjson<=1.2.47反序列化RCE漏洞
介绍:fastjson是一个Java语言编写的高性能功能完善的JSON库. 漏洞原因:fastjson在解析json的过程中,支持使用autoType来实例化某一个具体的类,并通过json来填充其属性 ...
- junit4的进一步探讨
上次只是大概记录了下junit4几个常见标签的用法. 在这篇文章中,我们来进一步分析junit4的用法. 1.断言 junit4中一个很常见的用法就是断言.说到断言,大家再熟悉不过了.不过也许有的朋友 ...
- Python3中用pip离线安装
本文原创,转载请注明出处. Python3 中 离线安装 ① 生成已安装模块列表,默认存在C:\Users\Administrator下 pip freeze > requirements.tx ...
- 超级好用的excel导出方法,比phpexcel快n倍,并且无乱码
public function exportToExcel($filename, $tileArray=[], $dataArray=[]){ ini_set('memory_limit','512M ...
- 用Python操作MySQL(pymysql)
用python来操作MySQL,首先需要安装PyMySQL库(pip install pymysql). 连接MySQL: import pymysql connect=pymysql.connect ...