-- 不能對(duì)ROWNUM使用>(大于1的數(shù)值)、>=(大于或等于1的數(shù)值)、=(大于或等于1的數(shù)值),否則無(wú)結(jié)果 -- 所以直接用只能從1開始 -- rownum >10 沒(méi)有記錄,因?yàn)榈谝粭l不滿足去掉的話,第二條的rownum又成了1,所以永遠(yuǎn)沒(méi)有滿足條件的記錄。 select * from student where rownum>=1;
--如果想要用rownum不從1開始,需按下面方法使用 select a1.* from (select student.*,rownum rn from student) a1 where rn >5;
--分頁(yè)查詢一 select * from (select a1.*,rownum rn from (select * from student) a1 where rownum <=5) where rn>=2;
--分頁(yè)查詢二 select a1.* from (select student.*,rownum rn from student where rownum <=5) a1 where rn >=3;
--分頁(yè)查詢?nèi)?/span> select a1.* from (select student.*,rownum rn from student) a1 where rn between 3 and 5;
|