ORDER BY keyword in SQL Server is used to sort / order result by ascending or descending format.
SQL Server provides tow keyword to sort result that are
1) ASC : To sort result in ascending format.
2) DESC : To sort result in descending format.
Let consider below list of shopping items, and we are going to apply ORDER BY keyword in this table.
Select the product from Shopping table where product price greater than 15000 and order by product name ascending order.
Note : SQL Server by default provide the sorting in ascending format ASC keyword is not mandatory to sort record set in ascending format.
Select the product from Shopping table order by price in descending format.
In descending order data get display from large to small value.
SQL Server provides the facility to sort data in ascending and descending format.
Note : If you see the above example we use order by ASC, DESC in same query. In above example we use the DealerCountry, Price in ascending format and ProductName in descending order.