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 ...
随机推荐
- delphi下webbrowser的应用
查找操作tagName为input的对象var i:Integer; myole:oleVariant; begin myole := wb1.Document; for i := 0 to myol ...
- DumpBinary
stdafx.h #include "targetver.h" #include <stdio.h> #include <tchar.h> #include ...
- Linux中的预定义变量
解释: 主要是Bash中已经定好的变量,名称不能自定义,作用也是固定的 $? 最后一次执行的命令返回状态,0为成功,非0为失败 $$ 当前进程的进程号 $! 后台运行的最后一个进程的进程号 例子: [ ...
- (4.8)SQL Server DAC——专用管理员连接
SQL Server DAC——专用管理员连接 默认情况下,只有本地可以使用DAC连接,但也可以开启远程DAC sp_configure ; go reconfigure with override; ...
- Ubuntu 14.04上安装WineTMQQ2013麒麟版
版权声明:本文为博主原创文章.未经博主同意不得转载. https://blog.csdn.net/tao_627/article/details/24187699 我先后试用了longterm团队的2 ...
- split命令
语法:split [OPTION]... [INPUT [PREFIX]]常用参数说明: -a, --suffix-length=N generate suffixes of l ...
- Verilog HDL设计规范及经验谈(转载)
1. 规范很重要 工作过的朋友肯定知道,公司里是很强调规范的,特别是对于大的设计(无论软件还是硬件),不按照规范走几乎是不可实现的.逻辑设计也是这样:如果不按规范做的话,过一个月后调试时发现 ...
- 常用MS-SQL写法整理
这里整理日常会用到的一些写法,一些常规的group by,系统函数等用法不在这里做记录了,大家有什么好的写法也可以分享下 1 sql操作xml内容(sp_xml_preparedocument和ope ...
- 剑指offer 面试22题
面试22题: 题目:链表中倒数第k个节点 题:输入一个链表,输出该链表中倒数第k个结点. 解题思路:为了实现只遍历链表一次就能找到倒数第k个节点,我们可以定义两个指针.让第一个指针先向前走k-1步,第 ...
- Shallow Copy & Deep Copy in Python list
今天在写一个小程序的时候用到了2维数组, 顺手就写成了[[0.0]*length]*length, 结果为了这个小错,调试了半个多小时, 其实之前对与浅复制和深复制已经做过学习和总结, 但真正编程用到 ...