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 ...
随机推荐
- 洛谷P1249最大乘积,数论找规律
这道题是数论加高精度,高精度倒好说,就是高精度乘法实现,模拟列竖式乘法,但是找出要乘的这几个数实属不容易,没学过数论,只能从题解中学怎么找规律这里引用一下洛谷题解区赞数最高的题解 不知道大家看其他的题 ...
- electron 安装 base64
1.安装这个:https://www.npmjs.com/package/js-base64 2.安装ts:https://www.npmjs.com/package/@types/js-base64
- Java8函数式接口Predicate实战
关于函数式接口 函数式接口 Funcational Interface 是指接口范围内只允许有一个抽象方法(不包括default和static方法)的接口.Java中有一些预定义的函数接口,如Pred ...
- Oracle 中UNDO与REDO的区别详解
一 为了更清楚的看出2者区别,请看下表: UNDO REDO Rec ...
- Java并发编程实例--11.在线程组中处理未检查异常
第8个例子讲了如何在线程中捕捉未检查异常,本例将介绍如何在线程组中处理未检查异常. Task.java package com.dylan.thread.ch1.c11.task; import ja ...
- Postman文件数据导入导出
https://zhuanlan.zhihu.com/p/535757471?utm_id=0
- 硬件开发笔记(十): 硬件开发基本流程,制作一个USB转RS232的模块(九):创建CH340G/MAX232封装库sop-16并关联原理图元器件
前言 有了原理图,可以设计硬件PCB,在设计PCB之间还有一个协同优先动作,就是映射封装,原理图库的元器件我们是自己设计的.为了更好的表述封装设计过程,本文描述了CH340G和MAX232芯片封装 ...
- window上使用Putty通过ssh远程连接并通过Xming实现X11图形界面功能
# 0.先确认远程服务器的ssh配置 >>> grep X11 /etc/ssh/sshd_config X11Forwarding yes #X11DisplayOffset 10 ...
- JVM类的加载和加载器
JVM类的加载和类的加载器 一.类的加载过程 类的加载指的是将类的.class文件中的二进制数据读入到内存中,将其放在运行时数据区的方法区内,然后在堆区创建一个java.lang.Class对象,用来 ...
- 【Azure Cache for Redis】Redis的导出页面无法配置Storage SAS时通过az cli来完成
问题描述 在Azure Redis的导出页面,突然不能配置Storage Account的SAS作为授权方式. 那么是否可以通过AZ CLI或者是Powershell来实现SAS的配置呢? 问题解答 ...