rank() over(partition by [field] order by [field] [asc/desc]) --同排名不连续 1 1 3
row_number() over(partition by [field] order by [field] [asc/desc]) --不同排名 1 2 3
dense_rank() over(partition by [field] order by [field] [asc/desc]) --同排名连续 1 1 2
count() over(partition by [field] order by [field] [asc/desc]) --统计
first_value([field])over(partition by [field] order by [field] [asc/desc]) --取第一个值
last_value([field]) over(partition by [field] order by [field] [asc/desc]) --取第一个值
-- max min avg集合函数均可以使用开窗函数
over子句的复用 (window)
WINDOW r AS ( PARTITION BY [field] ORDER BY [field] [asc/desc] )
--复用
row_number() over(r) as row_idx,
开窗函数,分组排序rank() over(partition by [field] order by [field] [asc/desc]) --同排名不连续 1 1 3row_number() over(partition by [field] order by [field] [asc/desc]) --不同排名 1 2 3dense () over(partition by [field] order by [field] [asc/desc]) .