Table test Data
SELECT * FROM Test ORDER BY name Desc
Results:
1-1:select * FROM (select A.*,rownum rn from Test A order by name ASC) where RN between 0 and 10
Results:
1-2:select * FROM (select A.*,rownum rn from Test A ORDER by name Desc) where RN between 0 and 10
Results:
2-1:select a.*,rownum from Test A where rownum between 0 and ten order by name Desc
Results:
2-2:select a.*,rownum from Test A where rownum between 0 and ten order by name ASC
Results:
3-1:select * FROM (select A.*,row_number () up (order by name Desc) as RN from Test A) where RN between 0 and 10
Results:
3-2:select * FROM (select A.*,row_number () over (order by name ASC) as RN from Test A) where RN between 0 and 10
Results:
Conclusion: The third type of query is to sort and fetch data first, and the first two is to fetch the data after the query, for the field is not the primary key.
Oracle Sequencing issues