MySQL Order By

MySQL Order By

MySQL Order By syntax and examples.

MySQL Order By syntax

SELECT * FROM table_name
ORDER BY column;

SELECT * FROM table_name
WHERE condition ORDER BY column;

Table books

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

Order By example

SELECT * FROM books 
WHERE id > 2
ORDER BY price;

Query Result

IDNAMEPRICE
4book412.0
3book315.0
5book518.0