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 ...
随机推荐
- PHP中的正则表达式相关函数
PHP中的正则表达式相关函数 常用的正则函数 1.执行一个正则表达式匹配 int preg_match ( string pattern , string subject [, array & ...
- P3730 曼哈顿交易 题解
题目链接:曼哈顿交易 比较容易想的题,观察下首先不带修改,考虑维护的东西:次数作为权值,这玩意很显然很难在线维护,考虑下离线算法.看到这种和次数有关的权值,典型的单点加入和删除是非常好找到变化的,那么 ...
- 关于Oracle多租户架构下的每个PDB的dbtime查询
有客户咨询在19c多租户这样的架构中,除了查询cdb本身外,还想查询具体pdb的负载(DB Time),但是使用之前的脚本发现查询不到,只显示cdb自己的结果,客户写的脚本如下: SELECT i.i ...
- 下载Apache软件基金的软件和项目(Hadoop相关组件)
一.下载Hadoop相关组件,可以到Apache软件基金的资源目录: Apache 分发目录地址:https://dlcdn.apache.org/ 二.下载软件 方法一:在页面中找到需要下载的软件目 ...
- 剑指Offer07 重建二叉树
剑指 Offer 07. 重建二叉树 前置概念: 前序:访问根节点,先序遍历左子树,先序遍历右子树: 中序:中序遍历左子树,访问根节点,中序遍历右子树: 后序:后序遍历左子树,后序遍历右子树,访问根节 ...
- 了解一下基本的tcp代理配置
我们首先用一个简单例子了解一下基本的tcp代理配置 worker_processes 1; #nginx worker 数量 error_log logs/error.log; #指定错误日志文件路径 ...
- 鸿蒙开发游戏(三)---大鱼吃小鱼(放置NPC)
效果图 添加了一个NPC(小红鱼),玩家控制小黄鱼 鸿蒙开发游戏(一)---大鱼吃小鱼(界面部署) 鸿蒙开发游戏(二)---大鱼吃小鱼(摇杆控制) 鸿蒙开发游戏(三)---大鱼吃小鱼(放置NPC) 鸿 ...
- CORS就是跨域吗?
首先,跨域的域是什么? 跨域的英文是:Cross-Origin. Origin 中文含义为:起源,源头,出生地. 在跨域中,"域"指的是一个 Web 资源(比如网页.脚本.图片等) ...
- 【Unity3D】MonoBehaviour的生命周期
1 前言 Unity3D 中可以给每个游戏对象添加脚本,这些脚本必须继承 MonoBehaviour,用户可以根据需要重写 MonoBehaviour 的部分生命周期函数,这些生命周期函数由系统自 ...
- journalctl命令
journalctl命令 journalctl命令是Systemd日志系统的一个命令,主要用途是用来查看通过Systemd日志系统记录的日志,在Systemd出现之前,Linux系统及各应用的日志都是 ...