ORDER BY Clause

The ORDER BY clause is used to sort the result set in either ascending or descending order. By default, it sorts in ascending order.

Example: Using ORDER BY Clause

SELECT Name, BirthDate FROM FreedomFighters ORDER BY BirthDate DESC;

Output:

Returns the names and birth dates of freedom fighters, sorted by birth date in descending order.

Notes

  • Use ASC for ascending order and DESC for descending order.
  • You can sort by multiple columns for more complex ordering.