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
ASCfor ascending order andDESCfor descending order. - You can sort by multiple columns for more complex ordering.