sql query order by column value code example
Example 1: order by in sql
ORDER BY: is for sorting result
either in descending or ascending order.
Example 2: sql order columns
SELECT * FROM table_name ORDER BY col1 ASC; -- ASCending is default
SELECT * FROM table_name ORDER BY col1 DESC; -- DESCending
SELECT * FROM table_name ORDER BY col1 DESC, col2 ASC; -- col1 DESC then col2 ASC