LIMIT Clause

The LIMIT clause specifies the maximum number of rows to return. If no LIMIT clause is specified, then SQL returns all rows.

LIMIT follows the syntax LIMIT {count}.

When working with two or more columns, make sure to use LIMIT with an ORDER BY clause, so that your results are returned in a specified order. Otherwise, results return in an order you may not want. ORDER BY is optional for working with a single column.

Here’s an example.

This query returns the cities in the first three rows of the dataset.

City
Aberdeen
Abilene
Akron
Akron
Akron