Table of Contents
MySQL Limit:
The LIMIT clause is used in the SELECT statement to constrain the number of rows in a result set. The LIMIT clause accepts one or two arguments. The values of both arguments must be zero or positive integers.
Syntax of MySQL Limit:
SELECT * FROM <table_name> LIMIT [Number to Limit By]; |
Example of MySQL Limit:
(1) MySQL LIMIT Clause set to 4:

(2) MySQL LIMIT Clause use along with ORDER BY Clause:

(3) MySQL LIMIT Clause use along with WHERE Clause:

MySQL Offset:
The offset specifies the offset of the first row to return. The offset of the first row is 0, not 1.
Syntax of MySQL Offset:
SELECT * FROM <table_name> LIMIT 4 OFFSET [Number of rows to skip]; |
Example of MySQL Limit and Offset Clause:
(1) MySQL LIMIT Clause set to 4 and OFFSET Clause to 0:

(2) MySQL LIMIT Clause set to 4 and OFFSET Clause to 1:

(3) MySQL LIMIT Clause set to 4 and OFFSET Clause to 7:

Comments (No)