ORDER BY clause statement


  • I need to ask u that what is the main use of ORDER BY clause ? why we use it ??
    Sunday, December 29, 2013 5:10 PM


  • Main use is to order the rows.  The standard behavior of a sql select query is to not return rows in a set order without an order by clause.

    A secondary use is with the Top key word.  It defines what the first rows are

    If using windowing functions they define how the window is drawn. What is the first row in the window, what is the last row, what is the previous, next row.

    Russel Loski, MCT, MCSE Data Platform/Business Intelligence. Twitter: @sqlmovers; blog:

    Sunday, December 29, 2013 5:16 PM