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 ...
随机推荐
- ArrayList中的遍历删除
ArrayList 中的遍历删除 在代码编写过程中经常会遇到这样的要求:遍历一个线性表,要求只遍历一遍(时间复杂度\(O(n)\)),删除符合指定条件的元素,且要求空间复杂度 \(O(1)\). 例如 ...
- NC16664 [NOIP2004]合唱队形
题目链接 题目 题目描述 N位同学站成一排,音乐老师要请其中的(N-K)位同学出列,使得剩下的K位同学排成合唱队形. 合唱队形是指这样的一种队形:设K位同学从左到右依次编号为1,2-,K,他们的身高分 ...
- Linux常用的20个命令(上)
无论你是后端程序员还是前端程序员,都避免不了和Linux打交道.Linux的命令有很多,这里仅介绍常用的20个,方便快速查看,也欢迎大家作补充. 1.mkdir 命令 make directories ...
- idea 灵异事件之maven 缓存
方法一 mvn clean install 方法二 强制刷新maven 1 idea 右侧的maven 窗口: 方法三 强制刷新maven 2 右键项目: 上面虽然是重新导入Maven依赖,按理说,I ...
- Zabbix 配置笔记
Zabbix Server 安装参考 https://www.cnblogs.com/clsn/p/7885990.html 安装脚本 #!/bin/bash #clsn #设置解析 注意:网络条件较 ...
- Shadow DOM的理解
Shadow DOM的理解 Shadow DOM是HTML的一个规范,其允许在文档document渲染时插入一颗DOM元素子树,但是这棵子树不在主DOM树中,Shadow DOM如果按照英文翻译的话可 ...
- join命令
join命令 join命令用于将两个文件中,指定栏位内容相同的行连接起来.其首先找出两个文件中指定栏位内容相同的行,并加以合并,再输出到标准输出设备. 语法 join [OPTION]... FILE ...
- Git实战系列教程
介绍 本文详细记录了Git一系列核心概念和工作中常用的操作命令,通篇以实际出发拒绝过度理论,值得典藏:). 概念 版本管理系统 版本控制是一种记录一个或若干文件内容变化,以便将来查阅特定版本修订情况的 ...
- Puppeteer介绍
Puppeteer是什么 Puppeteer是一个Node库,它提供了一个高级API来通过DevTools协议控制Chromium或Chrome. 可以使用Puppeteer来自动化完成浏览器的操作, ...
- 格式化占位符%r和!r
# 作用 都是格式化原形输出,!r用于format格式化,%r用于%格式化 # 示例 a = '123' b = 'hello, {!r}'.format(a) b = 'hello, %r' % ( ...