The ORDER BY keyword is used to sort the result-set.
The ORDER BY keyword is used to sort the result-set by a specified column.
The ORDER BY keyword sort the records in ascending order by default.
If you want to sort the records in a descending order, you can use the DESC keyword.
The "Persons" table:
Now we want to select all the persons from the table above, however, we want to sort the persons by their last name.
We use the following SELECT statement:
The result-set will look like this:
Now we want to select all the persons from the table above, however, we want to sort the persons descending by their last name.
Your Query was successfully sent!