表结构如下
create table IF NOT EXISTS SS
(
Id int,
Score double
)
row format delimited fields terminated by ',';
数据如下
Id Score
1 3.50
2 3.65
3 4.00
4 3.85
5 4.00
6 3.65
select Score,row_numer() over(order by Score desc) from SS;
Score rank
4.00 1
4.00 2
3.85 3
3.65 4
3.65 5
3.50 6
select Score,rank() over(order by Score desc) from SS;
4.00 1
4.00 1
3.85 3
3.65 4
3.65 4
3.50 6
select Score,dense_rank() over(order by Score desc) from SS;
4.00 1
4.00 1
3.85 2
3.65 3
3.65 3
3.50 4