185. Department Top Three Salaries
问题描述
解决方案
select b.name Department,a.name Employee,a.salary Salary
from Employee a,Department b
where a.departmentid=b.id and
(select count(distinct salary)
from Employee
where departmentid=a.departmentid and salary>a.salary
)<3
order by departmentid asc,salary desc ;
参考资料
- sql取出每个分组的前几条 http://blog.csdn.net/zhichao2001/article/details/6068893
185. Department Top Three Salaries的更多相关文章
- 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 ...
- [SQL]LeetCode185. 部门工资前三高的员工 | Department Top Three Salaries
SQL 架构 Create table If Not Exists Employee (Id ), Salary int, DepartmentId int) Create table If Not ...
- 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 ...
- leetcode185 Department Top Three Salaries
Employee表存储员工姓名.员工所在公寓.员工工资 Department表存储公寓id 评选出各个公寓的工资前三名的员工. 遇到的问题如下: limit,in等语句不能用在嵌套select语句中, ...
- [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 ...
- LeetCode All in One 题目讲解汇总(持续更新中...)
终于将LeetCode的免费题刷完了,真是漫长的第一遍啊,估计很多题都忘的差不多了,这次开个题目汇总贴,并附上每道题目的解题连接,方便之后查阅吧~ 477 Total Hamming Distance ...
随机推荐
- JavaSctipt语句for循环的思考
一.语法 for (语句 1; 语句 2; 语句 3) { 被执行的代码块; } 语句 1: 在循环(代码块)开始前执行, 可选. 语句 2: 定义运行循环(代码块)的条件, 可选, 如果省略了语句 ...
- C#通过反射打开相应窗体方法
C#单击菜单栏或工具栏时通过反射打开窗体的方法,可以以取代长长的if-else或switch-case语句.要点:将菜单或工具栏项的名称设置为与相应窗体名称相同(关键). private void M ...
- shadow批量破解
john有个参数可以设置破解时间,比如破解5秒则设置:--max-run-time=5,可以利用这个参数批量破解 for i in *;do (echo $i>>out;john --ma ...
- 我的Android进阶之旅------>Android中通过adb shell input来模拟滑动、按键、点击事件
今天在维护公司的一个小项目的时候,发现按公司手机的某个物理按键,激活相应的Service后,会在屏幕上模拟的点击了屏幕的某个坐标点.好家伙,原来是之前该项目的版本是按这个物理按键后,会弹出一个对话框, ...
- hive 安装警告 WARN conf.HiveConf: HiveConf of name hive.metastore.local does not exist
解决方法: 在0.10 0.11或者之后的HIVE版本 hive.metastore.local 属性不再使用. 在配置文件里面: <property> <name>hi ...
- LeNet5
Lecun Y, Bottou L, Bengio Y, et al. Gradient-based learning applied to document recognition[J]. Proc ...
- (转)fiddler使用简介--其一
原文地址:https://www.cnblogs.com/miantest/p/7289694.html Fiddler基础知识 Fiddler是强大的抓包工具,它的原理是以web代理服务器的形式进行 ...
- docker快速构建oracle数据库
1.查看可用镜像docker search oracle2.拉去想要的镜像docker pull wnameless/oracle-xe-11g3.基于wnameless/oracle-xe-11g创 ...
- [笔记]Go语言在Linux环境下输出彩色字符
Go语言要打印彩色字符与Linux终端输出彩色字符类似,以黑色背景高亮绿色字体为例: fmt.Printf("\n %c[1;40;32m%s%c[0m\n\n", 0x1B, & ...
- python Selenium库的使用
一.什么是Selenium selenium 是一套完整的web应用程序测试系统,包含了测试的录制(selenium IDE),编写及运行(Selenium Remote Control)和测试的并行 ...