当前位置:网站首页>SQL练习 2022/7/4
SQL练习 2022/7/4
2022-08-04 05:28:00 【Provence°_博】
SQL练习 2022/7/4
197. 上升的温度
代码思路
- 使用日期比较函数
select a.id
from Weather a,Weather b
where DATEDIFF(a.recordDate , b.recordDate ) = 1 and a.Temperature >b.Temperature
#或者
select a.id
from Weather a join Weather b
on DATEDIFF(a.recordDate ,b.recordDate)=1 and a.Temperature >b.Temperature
511. 游戏玩法分析
题干
代码思路:
- group by
select player_id,min(event_date) as first_login
from Activity
group by player_id
- 排名函数一下
- 使用 dense_rank 函数按照 player_id 和 event_date 进行排序,并算出排名将其作为临时表 temp
- 查询临时表 temp,筛选出 排名 = 1 数据
select player_id, event_date as first_login from (
select
player_id,
event_date,
dense_rank()
over(partition by player_id order by event_date) as 排名
from activity
) as temp where 排名 = 1;
边栏推荐
- 组原模拟题
- 智能合约安全——私有数据访问
- Oracle备份脚本
- warning C4251: “std::vector<_Ty>”需要有 dll 接口由 class“Test”的客户端使用错误
- Linux环境下redis的下载、安装和启动(建议收藏)
- 网络大作业心得笔记
- webtrc 中VideoAdapter类中的作用及局限
- CTFshow—Web入门—信息(9-20)
- Zend FrameWork RCE1
- The cost of automated testing is high and the effect is poor, so what is the significance of automated testing?
猜你喜欢
Delphi-C side interesting menu operation interface design
Code Refactoring: For Unit Testing
Embedded system driver primary [4] - under the basis of character device driver _ concurrency control
k3s-轻量级Kubernetes
win云服务器搭建个人博客失败记录(wordpress,wamp)
攻防世界MISC—MISCall
Linux环境下redis的下载、安装和启动(建议收藏)
Unity行为树AI分享
Unity Visual Effect Graph入门与实践
flink问题整理
随机推荐
PHP解决字符乱码问题(多种编码转换)
Swoole学习(一)
基于C语言的学生信息管理系统_(更新版)_(附源码和安装包)_课程设计_**往事随風**的博客
Zend FrameWork RCE1
个人练习三剑客基础之模仿CSDN首页
记录获取参赛选手信息过程
实际开发中,如何实现复选框的全选和不选
箭头函数的使用
Vulnhub:Sar-1
关系型数据库-MySQL:错误日志(log_error)
攻防世界MISC———Dift
flink-sql自定义函数
智能合约安全——delegatecall (1)
8.30难题留坑:计数器问题和素数等差数列问题
PHP实现异步执行程序
页面刷新没有执行watch?
程序员的财富观
Kubernetes基础入门(完整版)
lambda函数用法总结
计算属性的作用及使用?