leetcode数据库sql之Department Top Three Salaries
leetcode原文引用:
How would you print just the 10th line of a file?
For example, assume that file.txt has the following content:
Line 1
Line 2
Line 3
Line 4
Line 5
Line 6
Line 7
Line 8
Line 9
Line 10
Your script should output the tenth line, which is:
Line 10
我的sql语句如下:
SELECT d.name as department, e.name,e.salary
FROM Employee e JOIN Department d ON e.departmentid = d.id
and
(SELECT COUNT(DISTINCT (salary))
FROM
Employee
WHERE
departmentid = e.departmentid
AND salary > e.salary
) < 3
ORDER BY d.id ASC , e.salary DESC
leetcode数据库sql之Department Top Three Salaries的更多相关文章
- [LeetCode] Department Top Three Salaries 系里前三高薪水
The Employee table holds all employees. Every employee has an Id, and there is also a column for the ...
- [SQL]LeetCode185. 部门工资前三高的员工 | Department Top Three Salaries
SQL 架构 Create table If Not Exists Employee (Id ), Salary int, DepartmentId int) Create table If Not ...
- LeetCode - 185. Department Top Three Salaries
The Employee table holds all employees. Every employee has an Id, and there is also a column for the ...
- 【SQL】185. Department Top Three Salaries
The Employee table holds all employees. Every employee has an Id, and there is also a column for the ...
- LeetCode——Department Top Three Salaries(巧妙使用子查询)
The Employee table holds all employees. Every employee has an Id, and there is also a column for the ...
- 【leetcode】Department Top Three Salaries
The Employee table holds all employees. Every employee has an Id, and there is also a column for the ...
- 185. Department Top Three Salaries
问题描述 解决方案 select b.name Department,a.name Employee,a.salary Salary from Employee a,Department b wher ...
- leetcode185 Department Top Three Salaries
Employee表存储员工姓名.员工所在公寓.员工工资 Department表存储公寓id 评选出各个公寓的工资前三名的员工. 遇到的问题如下: limit,in等语句不能用在嵌套select语句中, ...
- leetcode 数据库十题记录
题目从难到易记录.解题过程中,如果不太熟悉,可以将题目中的表自己手动录入到自己的数据库中,就方便学习,测试. 185. Department Top Three Salaries 要求就是查询出每个部 ...
- [LeetCode]-DataBase-Department Top Three Salaries
The Employee table holds all employees. Every employee has an Id, and there is also a column for the ...
随机推荐
- Docker从认识到实践再到底层原理(六-2)|Docker容器操作实例
前言 那么这里博主先安利一些干货满满的专栏了! 首先是博主的高质量博客的汇总,这个专栏里面的博客,都是博主最最用心写的一部分,干货满满,希望对大家有帮助. 高质量博客汇总 然后就是博主最近最花时间的一 ...
- C++ GDAL提取多时相遥感影像中像素随时间变化的数值数组
本文介绍基于C++语言GDAL库,批量读取大量栅格遥感影像文件,并生成各像元数值的时间序列数组的方法. 首先,我们来明确一下本文所需实现的需求.现在有一个文件夹,其中包含了很多不同格式的文件, ...
- 练习(Java):将一个数转换为16进制;获得多位数的各个位上的数
//将一个数转换为十六进制 int num = 60; int i1 = num % 16; int i2 = num % (16*16) / 16; int i3 = num % (16*16*16 ...
- 西门子SIMATIC LPMLV30 库的模式和状态管理器
从基于S7-1200 / S7-1500的OMAC PackML V3.0获取到的文章内容,用于记录查看 基本信息 根据PackML_V3.0,该库包含了用于机械模式和状态管理器的功能模块. • 机械 ...
- 49从零开始用Rust编写nginx,我竟然在同一个端口上绑定了多少IP
wmproxy wmproxy已用Rust实现http/https代理, socks5代理, 反向代理, 负载均衡, 静态文件服务器,websocket代理,四层TCP/UDP转发,内网穿透等,会将实 ...
- NVME(学习笔记三)—PMR
PMR(Persistent Memory Region)持久性内存区域 NVM Express在2019年完成了NVMe 1.4规范的制定,新的NVMe协议带来了大量的全新特性,尤其在纠错.强化性能 ...
- Java 递归的方式将list集合的某一字段拼接单个String
场景介绍 要将list 集合中的某一个字段合并成一个字符串,并且要用符号 "|" 分割开每个拼接后的字段. 一个例子胜于一切的文字表达,拼接后的结果如下 str1|str2|str ...
- 【Unity3D】UGUI回调函数
1 简述 UGUI 回调函数主要指鼠标进入.离开.点下.点击中.抬起.开始拖拽.拖拽中.拖拽结束 UI 控件触发的回调.使用 UGUI 回调函数时,需要引入 UnityEngine.EventSy ...
- spring boot 2.0集成并使用redis
项目地址:https://gitee.com/indexman/spring_boot_in_action 前面一章介绍了spring boot自带的缓存,下面讲一下如何在2.0版本中集成并使用red ...
- win32 - 富文本控件的文本突出显示和文本撤销
#define UNICODE #define _UNICODE #include <tchar.h> #include <windows.h> #include <wi ...