1//this_for_descending_order..
2 SELECT * FROM TableName ORDER BY columnName DESC;
3 // this_for_ascending_order..
4SELECT * FROM TableName ORDER BY columnName ASC;
1Used with ORDER BY to return the data in ascending order.
2Example: Apples, Bananas, Peaches, Raddish
1To get the sorted result from MySQL select statement we use order by clause with SELECT statement.
2
3Syntax:
4SELECT column_list FROM tablename ORDER BY column_name1 [ASC][DESC],column_name2 [ASC][DESC],...
1SELECT
2 select_list
3FROM
4 table_name
5ORDER BY
6 column1 [ASC|DESC],
7 column2 [ASC|DESC],
8 ...;
1Used with ORDER BY to return the data in descending order.
2Example: Raddish, Peaches, Bananas, Apples