MySQL OrderBy

SQL ORDER BY clause is used to sort the data in ascending or descending order, based on one or more columns. Some database sorts query results in ascending order by default.

Syntax: The basic syntax of ORDER BY clause is as follows:

SELECT column-list FROM table_name [WHERE condition] [ORDER BY column1, column2, .. columnN] [ASC | DESC];

Let’s see an example:

1.select * from customers order by name, salary;
2.select * from customers order by name desc;