Mysql paging query is a common problem. How can this problem be achieved? The following describes how to implement mysql paging query.
Mysql paging query is a common problem. How can this problem be achieved? The following describes how to implement mysql paging query.
Using a feature of the select statement, you can easily implement the paging of mysql query results. The implementation process of this method is described in detail in the following sections.
Mysql paging query is a common problem. How can this problem be achieved? The following describes how to implement mysql paging query.
Mysql uses a feature of the select statement to conveniently implement paging of query results. The select statement implements the mysql paging query syntax:
The Code is as follows:
SELECT [STRAIGHT_JOIN] [SQL _SMALL_RESULT] [SQL _BIG_RESULT] [HIGH_PRIORITY]
[DISTINCT | DISTINCTROW | ALL]
Select_expression ,...
[Into outfile 'file _ name' export_options]
[FROM table_references
[WHERE where_definition]
[Group by col_name,...]
[HAVING where_definition]
[Order by {unsigned_integer | col_name | formula} [ASC | DESC],...]
[LIMIT [offset,] rows]
[PROCEDURE procedure_name]
The LIMIT clause can be used to LIMIT the number of data returned by the SELECT statement. It has one or two parameters. If two parameters are provided, the first parameter specifies the position of the first row returned in all data, starting from 0 (note not 1), the second parameter specifies the maximum number of returned rows. For example:
The Code is as follows:
Select * from table LIMIT 5, 10; # return data in rows 6-15
Select * from table LIMIT 5; # Return the first five rows
Select * from table LIMIT; # Return the first five rows
The above is the mysql paging Query Process.