The LIMIT clause limits the result of a query in the defined range. The range is defined by using one or two arguments, which both must be zero or a positive integer. The following example shows a basic syntax with the SELECT statement and LIMIT clause:

Syntax

SELECT * FROM table_name LIMIT offset, count;

The offset argument specifies the offset of the first row and it is often set on zero or omitted. If we omit the offset argument, then we will be selecting all the rows from the first one, to the one specified by the second parameter, which is the count argument. Therefore the count argument specifies the maximum number of rows to return.

In a realistic example, the LIMIT clause would be applied like this:

SELECT * FROM Emp LIMIT 0, 10;

The example above will list the first 10 employees (with all their columns) in the Emp table. We could have written that example as well like this:

SELECT * FROM Emp LIMIT 10;