oracle行号排序问题

1、创建一个student,并且插入数据

create table student(name varchar(12),age int)

insert into student values('z1','1');
insert into student values('z2','6');
insert into student values('z3','2');
insert into student values('z4','3');
insert into student values('z5','7');
commit;

2、直接按照age进行排序显示行号:

select * from(select rownum rw,t.* from student t order by t.age asc)

 

3另一种查询,能够很好地查找:

select row_number() over( order by t.age asc) rw,t.* from student t

 

posted on 2014-12-03 08:16  peng.zhang  阅读(1327)  评论(0编辑  收藏  举报

导航