当前位置:网站首页>Byte warehouse intern interview SQL questions
Byte warehouse intern interview SQL questions
2022-04-23 12:57:00 【Look at the data at the top of the mountain】
Subject requirements
id cnt url
1 12 a
2 21 f
1 32 eRelated instructions :
cnt Equivalent to date
Here, you need to split the table into the following types
id Maximum date url Minimum date url
1 32 e 12 a
The brain suddenly became hot , A little nervous in front of the interviewer , This problem has not been worked out , After the interview, I reviewed the question again , Concrete sql The statement is as follows
select
t3.id,t3.cnt,t3.url,t4.cnt,t4.url
from
(select
t1.*
from
(select
id,cnt,url,row_number() over(partition by id order by cnt) temp
from info) t1
where t1.temp <2 ) t3
join
(select
t2.*
from
(select
id,cnt,url,row_number() over(partition by id order by cnt desc) temp
from info) t2
where t2.temp <2) t4
on t3.id = t4.id
The main point of this problem is to eliminate the redundant columns , Only the largest and smallest columns are reserved in the table .
版权声明
本文为[Look at the data at the top of the mountain]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230615025321.html
边栏推荐
- Try the server for one month for free, and attach the tutorial
- 网站首页文件被攻击篡改的形式有哪些
- 解决disagrees about version of symbol device_create
- leetcode:437. 路径总和 III【dfs 选还是不选?】
- 22. Bracket generation
- There is no need to crack the markdown editing tool typora
- V-model binding value in El select, data echo only displays value, not label
- Object. The disorder of key value array after keys
- Huawei cloud MVP email
- Idea的src子文件下无法创建servlet
猜你喜欢

31. Next arrangement

Customize classloader and implement hot deployment - use loadclass

Image attribute of input: type attribute of fashion cloud learning -h5

CVPR 2022 & ntire 2022 | the first transformer for hyperspectral image reconstruction

SSM框架系列——Junit单元测试优化day2-3
![[Blue Bridge Cup] April 17 provincial competition brushing training (the first three questions)](/img/7d/23e2a611bc6a0d0239abdc79e2e8cf.png)
[Blue Bridge Cup] April 17 provincial competition brushing training (the first three questions)

NPDP | how can product managers not be excluded by programmers?

Importerror after tensorflow installation: DLL load failed: the specified module cannot be found, and the domestic installation is slow

leetcode:437. 路径总和 III【dfs 选还是不选?】

Teach you to quickly develop a werewolf killing wechat applet (with source code)
随机推荐
Web17——EL与JSTL的使用
NPDP | how can product managers not be excluded by programmers?
leetcode:437. 路径总和 III【dfs 选还是不选?】
NPDP|产品经理如何做到不会被程序员排斥?
Sort out several uses of network IP agent
Jupiter notebook installation
BUUCTF WEB [BJDCTF2020]The mystery of ip
ZigBee CC2530 minimum system and register configuration (1)
Can I take the CPDA data analyst certificate for 0 foundation
解决disagrees about version of symbol device_create
Luogu p5540 [balkanoi2011] timeismoney | minimum product spanning tree problem solution
Calculate the past date and days online, and calculate the number of live days
软件测试周刊(第68期):解决棘手问题的最上乘方法是:静观其变,顺水推舟。
Byte jump 2020 autumn recruitment programming question: quickly find your own ranking according to the job number
云原生KubeSphere部署Mysql
SSM框架系列——数据源配置day2-1
After the data of El table is updated, the data in the page is not updated this$ Forceupdate() has no effect
(1) Openjuterpyrab comparison scheme
Recommended website for drawing result map
Record a website for querying compatibility, string Replaceall() compatibility error