An in depth analysis of the usage of limit in mysql
- 2020-05-24 06:19:25
- OfStack
select * from table limit m,n m means index at the beginning of the record, starting at 0, n means starting at m, n.
mysql(root@localhost:test)>select * from total;
+----+-----------------+--------+------------+
| id | name | number | mydate |
+----+-----------------+--------+------------+
| 1 | Henan publishing house | 1000 | 2008-03-24 |
| 2 | Henan publishing house | 1200 | 2009-04-24 |
| 3 | Henan publishing house | 1100 | 2010-04-24 |
| 4 | Henan publishing house | 1400 | 2011-04-24 |
| 5 | Henan publishing house | 1350 | 2012-04-24 |
| 6 | Beijing publishing house | 2000 | 2008-03-24 |
| 7 | Beijing publishing house | 2020 | 2009-04-24 |
| 8 | Beijing publishing house | 2050 | 2010-04-24 |
| 9 | Beijing publishing house | 1980 | 2011-04-24 |
| 10 | Beijing publishing house | 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 publishing house | 1100 | 2010-04-24 |
| 4 | Henan publishing house | 1400 | 2011-04-24 |
| 5 | Henan publishing house | 1350 | 2012-04-24 |
+----+-----------------+--------+------------+
3 rows in set (0.00 sec)
That's basically what it means.