juniorMySQL
How the LIMIT clause works
Updated May 4, 2026
Short answer
Specifies the maximum number of records to return in a query.
Deep explanation
Used for performance and pagination. It instructs the engine to stop scanning as soon as the specified row count is reached.
Real-world example
Implementing 'Page 3' of a search result showing 10 items.
Common mistakes
- Not using ORDER BY with LIMIT, making the result set unpredictable.
Follow-up questions
- Is LIMIT 1 faster than SELECT *?