對於rownum來講它是oracle系統順序分配爲從查詢返回的行的編號,返回的第一行分配的是1,第二行是2,依此類推,這個僞字段能夠用於限制查詢返回的總行數
1單表查詢 sql
start頁面的起始位置,size 爲頁面要展現的信息個數: 網絡
SQL語句以下:若是有order by語句,那至少要使用兩個子查詢 oracle
select t.* from ( select tt.id,tt.name,rownum as rwn from ( select id ,name from student order by id ) tt where rownum<10) t where t.rwn>42多表查詢
select * from ( select p.*,rownum rwn from product p inner join productupid pu on p.id=pu.productid where rownum<5 ) where rwn> 2
select res.id from ( select p.*,rownum rwn from product p inner join productupid pu on p.id=pu.productid where rownum<5 ) res where rwn> 2