In-depth analysis of limit usage in mysql _ MySQL

Source: Internet
Author: User
In-depth analysis of limit usage in mysql

Select * from table limit m, n where m refers to the index at the beginning of the record, starting from 0, and n refers to taking n records starting from entry m.

Mysql (root @ localhost: test)> select * from total;
+ ---- + ----------------- + -------- + ------------ +
| Id | name | number | mydate |
+ ---- + ----------------- + -------- + ------------ +
| 1 | Henan press | 1000 | 2008-03-24 |
| 2 | Henan Publishing House | 1200 |
| 3 | Henan press | 1100 | 2010-04-24 |
| 4 | Henan Publishing House | 1400 |
| 5 | Henan press | 1350 | 2012-04-24 |
| 6 | Beijing press | 2000 |
| 7 | Beijing press | 2020 |
| 8 | Beijing press | 2050 | 2010-04-24 |
| 9 | Beijing press | 1980 |
| 10 | Beijing press | 2100 | 2012-04-24 |
+ ---- + ----------------- + -------- + ------------ +
10 rows in set (0.00 sec)

Mysql (root @ localhost: test)> select * from total limit 2, 3;
+ ---- + ----------------- + -------- + ------------ +
| Id | name | number | mydate |
+ ---- + ----------------- + -------- + ------------ +
| 3 | Henan press | 1100 | 2010-04-24 |
| 4 | Henan Publishing House | 1400 |
| 5 | Henan press | 1350 | 2012-04-24 |
+ ---- + ----------------- + -------- + ------------ +
3 rows in set (0.00 sec)

This is roughly the meaning.

BitsCN.com
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.