总结:
group 单纯分组
partition 也能分组,但还具备累计的功能
order by 排序,与计算函数联用,需要累加计算
0、select * from test; ---测试数据
1、select v1,v2,sum(v2) over(order by v2) as sum from test; --按照 v2排序,累计n+n-1+....+1
2、select v1,v2,sum(v2) over(partition by v1 order by v2) as sum from test; --先分组,组内在进行 1 中的操作
3、select v1,v2,sum(v2) over(partition by v1 order by v1) as sum from test; ---稳定排序
4、select v1,v2,sum(v2) over(partition by v1) as sum from test; --相同key的进行回填处理