The ORDER BY keyword is used to sort the results of the query in ascending or descending order.
By default The ORDER BY keyword sorts the records in ascending order. We can apply by ORDER BY on more than one column as well.
ORDER BY : keyword used to arrange records in a table either in ascending or descending order.
Table_name : The name of the table from where you want to fetch the data.
Column1Name, Column2Name : The name of the columns of the table which you want to uniquely fetch.
Let’s query PersonalInfo Table in our Demo Database and arrange the records in the latest order.
Figure 21.1. Select * from PersonalInfo;
Figure 21.2. Order by Desc on PersonalInfo;
Want More SQL Deep Dives