MySQL Sorting Results

The result set returned by the SELECT Query is free from any sort order unless you specify it in the SELECT statement.ORDER BY clause is used to sort the result set by a specified column or columns.The ORDER BY clause sorts the records in ascending order by default. To sort the result set in a descending order, use the DESC keyword.


  • We can sort returned result set on any column provided.
  • We can sort the result set on column or columns.
  • ASC or DESC keyword is used to get result in ascending or descending order accordingly. Default is ascending order.