1.
select a.*
from (select t.*, rownum rownum_
from (select * from project c order by c.project_name) t
where rownum <= 20) a
where rownum_ >= 1;
由执行计划可知,其先进行全表扫描,而后再进行全表排序,只会再取分页子集
2.
SELECT *
FROM (SELECT ROWNUM AS rowno, c.*
FROM project c
WHERE ROWNUM <= 20
order by c.project_name) table_alias
WHERE table_alias.rowno >= 1;
虽然2的效率可能不如1,但1也许不是我们所想要的排序方式。