home support FAQ resources services partners contact us contact us
 MySQL Tutorial Previous  Next  
 

mysql> SELECT last_name, first_name, birth FROM president
-> ORDER BY birth DESC LIMIT 5;

last_name first_name birth
Clinton
Bush
Carter
Bush
Kennedy
William J.
George W.
James E.
George H.W.
John F
1946-08-19
1946-07-06
1924-10-01
1924-06-12
1917-05-29


LIMIT also allows you to pull a section of records out of the middle of a result set. To do this, you must specify two values. The first value is the number of records to skip at the beginning of the result set, and the second is the number of records to return. The following query is similar to the previous one but returns 5 records after skipping the first 10:

last_name first_name birth
Tyler
Buchanan
Polk
Fillmore
Pierce
John
James
James K.
Millard
Franklin
1790-03-29
1791-04-23
1795-11-02
1800-01-07
1804-11-23

Previous  Next  
Link Partners: Asia florist, Flowers to India, Hong kong flowers, Site submit, Cheap web hosting, China florist, Japan florist