oracle中的rownum

create table person(ID char(6), name VARCHAR2(100));
insert into person values('200001',‘徐一’);
insert into person values('200002',‘李二’);
insert into person values('200003',‘张三’);
insert into person values('200004',‘小四’);

commit; it

等于1:select rownum,id,name from student where rownum=1; table

大于2:select * from(select rownum no ,id,name from student) where no>2; select

闭区间:select * from (select rownum no,id,name from student where rownum<=3 ) where no >=2; 查询

rownum伪列,每次查询都是从1开始,因此要想查询,大于或者区间须要用子查询。 tab

相关文章
相关标签/搜索