The paging query statements of mysql are: 1. "select*from tablename limit index,pageNum" statement; 2. "select*from tablename limit pageNum offset index" statement.
The operating environment of this tutorial: windows10 system, mysql8.0.22 version, Dell G3 computer.
What is the paging query statement of mysql?
The first type:
select * from tablename limit index,pageNum;
index represents the index from the table Start searching for several pieces of data; (Note: the serial number of the first piece of data is 0)
pageNum indicates how many pieces of data are on each page;
Second type:
select * from tablename limit pageNum offset index;
index Indicates which piece of data in the table to start searching from; (Note: the serial number of the first piece of data is 0)
pageNum indicates how many pieces of data per page;
Note:
1. Database data calculation starts from 0
2.offset X is to skip X data, limit Y is to select Y data
3.limit X,Y X means skipping Start querying from the first data, take one piece of data, that is, read the third data, skip the first and second data
② Start querying two pieces of data from the second data in the database, that is, the second and third data strip.
Recommended learning:
mysql video tutorialThe above is the detailed content of What is the paging query statement of mysql?. For more information, please follow other related articles on the PHP Chinese website!