Oracle paging query tutorial and oracle paging tutorial

Source: Internet
Author: User

Oracle paging query tutorial and oracle paging tutorial

SELECT *

FROM (select rownum as rowno, t .*

FROM table t where rownum <= page * size) table_aliasWHERE table_alias.rowno> (page-1) * size;

Page with order by statement: SELECT *

FROM (select rownum as rowno, r .*

FROM (SELECT * FROM table t

Order by t. element asc

) R

Where ROWNUM <= page * size

) Table_alias

WHERE table_alias.rowno> (page-1) * size;

The upper limit condition must be placed in the subquery, and the lower limit condition must be placed in the outer query (rownum always starts from 1. If the first condition does not meet the condition, the rownum of the second row becomes 1 ).

By the way, the SQL format for querying by page in MySql is: select * from table limit m, n;

Where m is the start page number of each page, n is the number of lines displayed per page, m = (pageNum-1) * n

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.