当前位置:网站首页>Windowing function (1) - top three employees of department salary
Windowing function (1) - top three employees of department salary
2022-07-24 18:22:00 【A song】
Known table

subject
Company executives are interested in who makes the most money in each department of the company . Of a department High income earners It refers to the salary of an employee in the... Of the Department Different In salary Top three .
Write a SQL Inquire about , Find out... In each department High paid employees .
With In any order Return result table .
Example

Refer to the answer
select
base.Department,
base.Employee,
base.Salary
from
(select
b.name as 'Department',
a.name as 'Employee',
a.salary as 'Salary',
dense_rank() over(partition by a.departmentId order by a.salary desc) as 'salary_rank'
from
Employee a
join
Department b
on
a.departmentId = b.id
) as base
where
base.salary_rank <=3
source : Power button (LeetCode)
link :https://leetcode.cn/problems/department-top-three-salaries
边栏推荐
- 手写博客平台~第二天
- XSS bypass pose summary
- 【刷题记录】20. 有效的括号
- undefined reference to H5PTopen
- 剑指 Offer 21. 调整数组顺序使奇数位于偶数前面
- Wechat applet
- How to quickly upload files to Google Lab
- Array object methods commonly used traversal methods & higher-order functions
- Section 10 cache breakdown follow Daewoo redis ------- directory post
- 13 essential methods of color!
猜你喜欢

Icml2022 Best Paper Award: learning protein reverse folding from millions of predicted structures

【“码”力全开,“章”显实力】2022年第1季Task挑战赛贡献者榜单

pycharm配置opencv库

关于接口的写法 1链式判读 ?. 2方法执行 (finally)一定会执行

How to render millions of 2D objects smoothly with webgpu?

Go language file operation

Wechat applet

How to solve the problem that yaml in idea is unrecognized or red?

6126. 设计食物评分系统

Go language interface and type
随机推荐
pycharm配置opencv库
Date function format conversion
[opencv] - thresholding
【校验】只能输入数字(正负数)
【刷题记录】20. 有效的括号
字符串常用方法(2)
pinia 入门及使用
T245982 "kdoi-01" drunken flower Yin
Introduction and use of Pinia
6126. Design food scoring system
数组常用方法(2)
CF. Bits And Pieces(子集状压dp + 剪枝)
线段树合并板子
Section 11 cache avalanche, hot data failure follow Daewoo redis ------- directory post
The drop-down list component uses iscrol JS to achieve the rolling effect of the pit encountered
Icml2022 Best Paper Award: learning protein reverse folding from millions of predicted structures
Model saving and loading of sklearn
Problems needing attention in writing pages
如何为超级通胀做好准备
Handwritten blog platform ~ the next day