The SQL keyword used to sort the result of a query is ORDER BY
.
It allows you to specify the column(s) by which the results should be sorted, and you can also define the sorting order (ascending or descending).
Here's an example of how it's used:
SELECT * FROM Employees
ORDER BY last_name ASC;
In this query:
ORDER BY last_name
sorts the results based on thelast_name
column.ASC
(ascending) means the results will be sorted from A to Z (lowest to highest). You can also useDESC
for descending order (Z to A or highest to lowest).
No comments:
Post a Comment