Hive
**row_number() over()**直接排序,10个第1名排名为1到10
select user_id,pay_time,amont,Row_Number() OVER (partition by user_id ORDER BY amont desc ) rank from tmp
**rank() over()**是跳跃排序,有两个第二名时接下来就是第四名
select workdept,salary,rank() over(partition by workdept order by salary) as dense_rank_order from emp order by workdept;
**dense_rank() over()**是连续排序,有两个第二名时仍然跟着第三名
select workdept,salary,dense_rank() over(partition by workdept order by salary) as dense_rank_order from emp order by workdept;