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 ...
随机推荐
- Intel 4工艺太难了!酷睿Ultra终于突破5GHz
无论是14nm还是10nm,Intel这些年的新工艺都有一个通性:刚诞生的时候性能平平,高频率都上不去,只能用于笔记本移动端(分别对应5代酷睿.10代酷睿),后期才不断成熟,比如到了13代酷睿就达到史 ...
- Java 如何在日志中优雅的打印 Exception
一.使用 log 库打印 使用 log 库如 slf4j @Slf4j public class MyDemo { public void demo() { try { int a = 10 / 0; ...
- MySQL 中 针对表和列的注释,方便使用其生成的实体类。mybatis-generator
- Java集合篇之深入解析ArrayList,这六问你答的上来吗?
写在开头 开年第一篇,先祝各位新的一年身体健康,学业有成,事业有成哈,春节期间就是咔咔乱吃,咔咔乱玩,把学习都抛一边子去了,已经9天没有学习了,深深的懊悔,从今天开始,2024年的学习正式开启,一起给 ...
- STM32F407VET6烧录出现flash download failed target dll has been cancelled
今天在通过stlink烧录一个长时间未用的STM32F407VET6 Black Board的时候, 出现错误 Internal command error Flash download failed ...
- Python之记录日志
日志级别 DEBUG: 最低级别,用于调试小细节. INFO:记录程序中的一般事件或确认一切工作正常. WARNING:表示可能出现的问题,但不会终止程序工作. ERROR:用于记录错误,会导致程序失 ...
- 一次nginx返回422状态码的经历
故事背景 后端使用Docker Compose部署一个代码片段管理应用:snibox,某天因为云服务卡死重启之后再次访问时,登录或退出都返回422状态码. 界面提示如下: 不过奇怪的是:直接通过IP+ ...
- OsgEarth开发笔记(四):Qt5.15.2在QtCreator集成Osg3.6.3+OsgEarth3.1+OsgQt的vs2019x64版本开发环境搭建
前言 本篇非常麻烦,博主用QtCreator作为IDE,因为Osg3.6.3放弃对osgQt的支持,集成起来比较繁琐. 前提 基于前面三篇的基础上,才可以进行本篇. Demo演示:Qt ...
- ProtoBuffer-nanopb介绍
目录 一.需求 二.环境 三.相关概念 3.1 protocol buffer介绍 3.2 nanopb(支持C语言) 3.3 proto文件 四.proto基本语法 4.1 proto文件的定义 4 ...
- React实现导航栏点击高亮
在jquery中实现导航栏的切换只需要一行代码找到同级其他元素removeClass以及添加点击元素addClass就可以实现了,但是React没法直接找到同级元素,这个时候需要一点js中的思维,根据 ...