MySQL Limit Query - How to Limit Query Results
Sometimes it is useful to limit the number of rows that are returned from an SQL query. For example, if a user knows exactly which rows of a table they are interested in, they can specify which of those rows to return via the MySQL limit syntax. This can be especially useful when querying very large tables.
The MySQL limit syntax can either return the first so many rows from a database table, or it can also return a range of rows from the database table. Listed below are some examples.
Example 1: Returning the first 100 rows from a table called employee:
select * from employee limit 100
Example 2: Returning a range of rows from a table called employee (starting at record 2, return the next 4 rows):
select * from employee limit 2,4