LIMIT restricts the number of rows returned by a query. It is commonly supported by MySQL, PostgreSQL, SQLite, and several other database systems.
Limiting results is useful when testing queries, previewing data, or retrieving only a small number of records.
An analyst can retrieve the first 10 customer records to quickly inspect the table.
SELECT
*
FROM Customers
LIMIT 10;
LIMIT is useful for data exploration, testing, pagination, previews, and sample analysis.
- LIMIT restricts returned rows.
- It is supported by several database systems.
- It is useful for previews.
- It can support pagination patterns.
- Other databases may use different syntax.
What does LIMIT do?
LIMIT restricts the number of rows returned by a query in database systems that support it.
Is LIMIT supported by every database?
No. Different database systems may use alternatives such as TOP or FETCH.