Monday, November 19, 2012

Limit - MySQL Command

Limit is used to limit your MySQL query results to those that fall within a specified range. It is use for select number of row of record from your query.

your table record : 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15

SELECT * FROM 'YourTable' Limit 10
- It will select 10 rows of record from the table.

Result : 1,2,3,4,5,6,7,8,9,10


SELECT * FROM 'YourTable' LIMIT 0, 3 
- It will return 3 rows of record and start from index 0

Result : 1,2,3


SELECT * FROM 'YourTable' LIMIT 2, 3 
- It will return 3 rows of record and start from index 2

Result : 3,4,5