0
点赞
收藏
分享

微信扫一扫

SQL面试题-数据转换-窗口函数应用

SQL面试题-数据转换-窗口函数应用_sql

hive> select * from temp;
OK
1 abc 10
1 def 15
1 xyz 20
2 abc 13
2 xyz 40
3 def 50
3 abc 60
Time taken: 0.282 seconds, Fetched: 7 row(s)
hive> select cn,dt,sum(point) over(partition by cn order by dt) as sumpoint from temp order by sumpoint;
OK
abc 1 10
def 1 15
xyz 1 20
abc 2 23
xyz 2 60
def 3 65
abc 3 83
Time taken: 9.746 seconds, Fetched: 7 row(s)

SQL如下

select cn,dt,sum(point) over(partition by cn order by dt) as sumpoint from temp order by sumpoint;


举报

相关推荐

0 条评论