Database paging query and database Paging

Source: Internet
Author: User

Database paging query and database Paging

1) mysql

Select * from demowhere1 = 1 LIMIT 2 and 3

Limit is used for paging. The first parameter is the row number, and the second parameter is the number of rows.


2) oracle

First

Select id, FIELD_NAME ,... FROM TABLE_NAME where id in (select id from (select rownum as numrow, id from TABLE_NAME WHERE Condition 1 order by condition 2) where numrow> 80 and numrow <100) order by Condition 3;

Second

SELECT * FROM (SELECT a. *, rownum rn FROM (SELECT * FROM table_name) a WHERE rownum <= 40) WHERE rn> = 21


If scrollable result is supported, use the absolute method of ResultSet to directly move to the query start point. If not, use the loop statement and move rs. next a little bit.





Zookeeper

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.