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

 

你可能感兴趣的:(oracle)