Home>Article>Database> What is the paging query statement of mysql?

What is the paging query statement of mysql?

WBOY
WBOY Original
2022-01-05 09:36:38 12326browse

The paging query statements of mysql are: 1. "select*from tablename limit index,pageNum" statement; 2. "select*from tablename limit pageNum offset index" statement.

What is the paging query statement of mysql?

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 tutorial

The 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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn