Mysql Limit Offset Usage example

Source: Internet
Author: User

The content of this article:
Mysql Limit Offset Example

Example 1, suppose that there are 13 data in the database table student.

code example:
Statement 1:select * FROM student limit 9,4
Statement 2:slect * FROM student limit 4 offset 9
Statements 1 and 2 return rows 10th, 11, 12, 13 of the table student
4 in Statement 2 returns 4 rows, 9 means starting from row tenth of the table

Example 2, the paging function can be achieved by limit and offset or by limit only.
Assuming that numberperpage represents the number of bars to display per page, pagenumber represents the page number, then return to page pagenumber, the SQL statement with the number of numberperpage per page:

code example:
Statement 3:select * FROM studnet limit (pagenumber-1) *numberperpage,numberperpage
Statement 4:select * FROM student limit numberperpage offset (pagenumber-1) *numberperpage

Reprint: http://blog.csdn.net/iastro/article/details/53037600

Mysql Limit Offset Usage example

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.