Oracle Sequencing issues

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.