Various types of database paging sharing

Source: Internet
Author: User


Select * from (select TOP size * FROM (select top (start * size) * from table_name order by id ASC) as aSysTable order by id DESC) as bSysTable order by id ASC

Size: number of records retrieved each time

Start: number of requested pages

MySQL (SQLLite paging is also the same as MySQL ):

Select * from table_name limit start, pageNum

Start: The data location [starting from 0]

For example, start = 0 | ageNum = 5
That is to say, retrieve 1-6 data records.


SELECT * FROM (SELECT a. *, ROWNUM row_num FROM (table_name) a) B

WHERE B. row_num BETWEEN 1 AND 3

This is the first to third record from table_name.

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: 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.