How To Limit The Number Of MySQL Query Result

If you use MySQL as your database, sometimes you may want to limit the number of result queried from the database. here is where the MySQL limit function can come in handy.

Example

Returning the first 10 rows from a table called staff:

[sql]SELECT * FROM staff LIMIT 10[/sql]

Another example is when you trying to retrieve a range of rows from a table:

[sql]SELECT * FROM staff LIMIT 5, 5[/sql]

This will show records 6, 7, 8, 9, and 10

Don’t miss out!
Subscribe to My Newsletter
Invalid email address