How to order results in SQL? ORDER BY — Parv The IT Geek

A basic query of the HumanResources.Department table bring s the following results.

If you wanted to reverse the order of the DepartmentID then you would need to user the ‘ORDER BY’ clause.

The default sort is always ascending ( ASC) but it does not have to be explicitly written. If you want the order to be reversed then you would need to use DESC ( descending).

Sorting of results can also be done on numbers, dates, letters……

Originally published at on January 17, 2014.


Published by Parvinder Nijjar

I blog at

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: