不能對ROWNUM使用>(大于1的數(shù)值)盛险、>=(大于或等于1的數(shù)值)稿黍、=(大于或等于1的數(shù)值)详囤,否則無結(jié)果
所以直接用只能從1開始
rownum >10 沒有記錄暴拄,因為第一條不滿足去掉的話于个,第二條的rownum又成了1氛魁,所以永遠(yuǎn)沒有滿足條件的記錄。
select * from student where rownum>=1;
如果想要用rownum不從1開始厅篓,需按下面方法使用
select a1.* from (select student.*,rownum rn from student) a1 where rn >5;
分頁查詢一
select * from (select a1.*,rownum rn from (select * from student) a1 where rownum <=5) where rn>=2;
分頁查詢二
select a1.* from (select student.*,rownum rn from student where rownum <=5) a1 where rn >=3;
分頁查詢?nèi)?/h2>
select a1.* from (select student.*,rownum rn from student) a1 where rn between 3 and 5;