MySQL LIMIT Clause

The LIMIT clause is used in MySQL to limit the number of results returned in a query. It can be used in SELECT, UPDATE, DELETE, and REPLACE statements.

The basic syntax of the LIMIT clause is as follows:

SELECT column1, column2, ...
FROM table_name
LIMIT number_of_rows_to_return;

Here, number_of_rows_to_return specifies the maximum number of rows that should be returned by the query.

For example, to select the first 10 rows from a table called customers, you would use the following query:

SELECT *
FROM customers
LIMIT 10;

You can also use the LIMIT clause with an OFFSET parameter to specify where to start returning results. The OFFSET parameter specifies the number of rows to skip before starting to return rows.

For example, to select the 11th to 20th rows from the customers table, you would use the following query:

SELECT *
FROM customers
LIMIT 10 OFFSET 10;

Note that the OFFSET parameter is zero-indexed, so an offset of 10 skips the first 10 rows and starts returning rows from the 11th row.

Wordpress Social Share Plugin powered by Ultimatelysocial
Wordpress Social Share Plugin powered by Ultimatelysocial