恒生电子SQL题第三题

with t1 as (select
    finance_mic,prod_code,trade_date,data_timestamp,
    round(data_timestamp / 100000) flag,
    count(*) over (partition by round(data_timestamp / 100000) order by data_timestamp) cnt,
    first_value(last_px) over (partition by round(data_timestamp / 100000 ) order by data_timestamp) open_px,
    last_value(last_px) over (partition by round(data_timestamp / 100000 ) order by data_timestamp) close_px,
    max(last_px) over (partition by round(data_timestamp / 100000 ) order by data_timestamp) high_px,
    min(last_px) over (partition by round(data_timestamp / 100000 ) order by data_timestamp) low_px
from hq_stock_snapshot
where finance_mic = 'XSHG' and prod_code = '600570'
  and trade_date = 20230703 and data_timestamp >= 93000000 and data_timestamp < 100000000
)
select
    finance_mic, prod_code, trade_date, data_timestamp,open_px,high_px,low_px,close_px
from
(
    select *,row_number() over (partition by flag order by cnt desc) rk from t1
)t2 where rk = 1;
全部评论
1 回复 分享
发布于 2023-10-14 08:46 吉林
我超,这么猛
1 回复 分享
发布于 2023-10-13 21:47 浙江
666.别的呢
点赞 回复 分享
发布于 2023-10-14 00:27 江苏
读了好久题目才读懂,好恶心
点赞 回复 分享
发布于 2023-10-13 21:14 江苏

相关推荐

你是我的最优解L:这题是不是优化快排就能解出来?
点赞 评论 收藏
分享
06-12 17:46
门头沟学院 Java
运营你豪哥:来说重点: ​1.项目前置,时间倒序。​​ 2.​项目描述强化结果与量化效果(STAR原则里的R)。​​ ​3.个人技能精炼,明确掌握程度,突出核心。​​ ​4.增加强有力开头的个人总结部分。​​ 5.​优化教育背景(成绩排名)、合并奖项与活动。​​
听劝,我这个简历该怎么改...
点赞 评论 收藏
分享
评论
4
7
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务