当前位置:网站首页>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;
边栏推荐
猜你喜欢

OpenGLES 学习之帧缓存

对象存储-分布式文件系统-MinIO-2:服务端部署

Unity表格配置编辑工具

CAS与自旋锁、ABA问题
![Embedded system driver primary [4] - under the basis of character device driver _ concurrency control](/img/96/5224d2de152eb738703cd201fb8407.png)
Embedded system driver primary [4] - under the basis of character device driver _ concurrency control

Wwise入门和实战

自动化运维工具Ansible(3)PlayBook

智能合约安全——溢出漏洞

ORACLE LINUX 6.5 安装重启后Kernel panic - not syncing : Fatal exception

MySQL事务详解(事务隔离级别、实现、MVCC、幻读问题)
随机推荐
IP地址查询
EventBus源码分析
关系型数据库-MySQL:二进制日志(binlog)
Wwise入门和实战
JNI基本使用
Commons Collections2
NFT市场以及如何打造一个NFT市场
flink-sql自定义函数
关系型数据库-MySQL:多实例配置
EPSON RC+ 7.0 使用记录一
Set集合与Map集合
ORACLE LINUX 6.5 安装重启后Kernel panic - not syncing : Fatal exception
Vulnhub:Sar-1
完美解决keyby造成的数据倾斜导致吞吐量降低的问题
php将多维数据保存进json文件
关于C#的反射,你真的运用自如嘛?
【树 图 科 技 头 条】2022年6月27日 星期一 今年ETH2.0无望
Unity自动生成阻挡Collider的GameObject工具
Delphi-C side interesting menu operation interface design
Several ways to heavy