The fastest paging speed in Oracle --- SQL statement explanation

Source: Internet
Author: User

Rowid SQL statement explanation

Select * from mytable2 s1 where rowid in (select rid from (select rownum r1, rid from (select rowid rid from mytable2) where rownum <= 10) where r1> = 3 );

Select rowid rid from mytable2 indicates using rowid to identify mytable2 (rowid is an Oracle System Function)

Select rownum r1, rid from (select rowid rid from mytable2) where rownum <= 10 indicates adding the rownum field (rownum is an oracle system function). The table found in the previous step is used as an embedded table.

Rownum <= 10 indicates the first 10 records to be queried.

Select rid from (select rownum r1, rid from (select rowid rid from mytable2) where rownum <= 10) where r1> = 1) rownum> = 3 returns the rowid Value

Rownum> = 3 indicates that the first 10 records not including the first 3 Records

Where rowid in indicates that the rowid result queried in the subquery matches the rowid in mytable2.

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.