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

相關文章
相關標籤/搜索