Use the select statement to implement mysql paging Query

Source: Internet
Author: User

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:

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

The above is the mysql paging Query Process.

Take you to the DB2 Character Set and MySql Character Set

Using SSIS to build MySQL monitoring tools

Differences between single-column and combined indexes in MySQL

Mysql table alias usage

What is Mysql table sharding?

Related Article

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.