MySQL Limit

MySQL Limit

MySQL LIMIT syntax and examples.

MySQL LIMIT syntax

SELECT * FROM table_name
LIMIT val;

SELECT * FROM table_name
WHERE condition
ORDER BY column
LIMIT val;

Table books

IDNAMEPRICE
1book120.0
2book225.0
3book315.0
4book412.0
5book518.0

LIMIT example

SELECT * FROM books 
ORDER BY price desc 
LIMIT 1;

Query Result

IDNAMEPRICE
2book225.0