MySQL : About LIMIT 0 , 30
Limit is used to limit your MySQL query results to those that fall within a specified range. You can use it to show the first X number of results, or to show a range from X - Y results. It is phrased as Limit X, Y and included at the end of your query.
X is the starting point (remember the first record is 0) and Y is the duration (how many records to display).
Table 'example' have following data.
SELECT * FROM `example` ORDER BY `example`.`age` ASC LIMIT 0 , 30
SELECT * FROM `example` ORDER BY `example`.`age` ASC LIMIT 3 , 1
This will show records 3rd only (
X is the starting point (remember the first record is 0) and Y is the duration (how many records to display).
Table 'example' have following data.
SELECT * FROM `example` ORDER BY `example`.`age` ASC LIMIT 0 , 30
id name age
3 Amit 26
5 pani 27
2 Sanjay 28
4 Lucky 29
6 atul 30
1 Kumar 31
SELECT * FROM `example` ORDER BY `example`.`age` ASC LIMIT 3 , 1
id name age
4 Lucky 29
remember the first record is 0
)
Comments