Order by clause used for sort the result by one or more column. by default order by sort the result sets in ascending order. but we can add the hint to sort in ascending or descending order.
Order by Column_name|Column_List ASC|DESC
create and insert table scripts:https://flamboyencewithsql.wordpress.com/2014/03/13/joins-in-sql-server/
Example: Here we need the result set with lowest salary on top and then second lowest and so on.
order by Salary ASC
Now we need the result set with descending order of name and if the name are same for multiple rows then ascending order of salary.
ORDER BY Name DESC,Salary ASC
Hope you will like this post on Microsoft SQL Server.
If you really like reading my blog and understood at least few thing then
please don’t forget to subscribe my blog.
Connect With me on