MySQL query page is a feature that we often need to implement. The following describes how to implement MySQL query page. I hope you can learn more about MySQL query pages.
Using a feature of the select statement in mysql, you can easily implement MySQL query paging. the syntax of the select statement 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 that it is not 1). The second parameter specifies the maximum number of returned rows. For example:
- 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
Use functions to query row numbers in MySQL
Non-empty question in MySQL Query
MySQL Date and Time Functions
Transformed from the MySQL Query Class of discuz
How to query intermediate records in MySQL