MySQL query paging using the select statement feature

Source: Internet
Author: User

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:

 
 
  1. SELECT [STRAIGHT_JOIN] [SQL_SMALL_RESULT]   
  2. [SQL_BIG_RESULT] [HIGH_PRIORITY]   
  3. [DISTINCT | DISTINCTROW | ALL]   
  4. select_expression,...   
  5. [INTO OUTFILE ?file_name? export_options]   
  6. [FROM table_references   
  7. [WHERE where_definition]   
  8. [GROUP BY col_name,...]   
  9. [HAVING where_definition]   
  10. [ORDER BY {unsigned_integer |   
  11. col_name | formula} [ASC | DESC] ,...]   
  12. [LIMIT [offset,] rows]   
  13. [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:

 
 
  1. Select * from table LIMIT 5, 10; # return data in rows 6-15
  2. Select * from table LIMIT 5; # Return the first five rows
  3. 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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.