时间:2021-07-01 10:21:17 帮助过:43人阅读
首先,来构造一些数据 drop table test;create table test( name varchar2(10), account number(5)); insert into
首先,,来构造一些数据
drop table test;
create table test
(
name varchar2(10),
account number(5)
);
insert into test values ('张三','5');
insert into test values ('王五','10');
insert into test values ('小二','10');
insert into test values ('李四','20');
insert into test values ('小三','40');
insert into test values ('小四','50');
insert into test values ('小五','90');
insert into test values ('小六','90');
insert into test values ('小七','90');
commit;
下面来看一下一些方式的排名结果:
1. select t.*,dense_rank() over(order by t.account asc) 排名 from test t;
2. select t.*,dense_rank() over(order by t.account desc) 排名 from test t;
3. select t.*,rank() over(order by t.account asc) 排名 from test t;
4. select t.*,rank() over(order by t.account desc) 排名 from test t;