Showing posts with label order by. Show all posts
Showing posts with label order by. Show all posts

Monday, December 6, 2010

Order By Keywork in SQL

The keyword "order by" is used to sort the result set.

This sorts a specified column and by default it sorts in ascending order but you may specify the word "Desc" to get result set in descending order.

For ascending sort:
Select column(s) From Table_Name order by column1
Select column(s) From Table_Name order by column1 asc

For descending sort:
Select column(s) From Table_Name order by column1 desc