ORDER BY
clauseORDER BY order_by_expression [ COLLATE collation_name ] [ ASC | DESC ] [ ,...n ] [ <offset_fetch> ] <offset_fetch> ::= { OFFSET { integer_constant | offset_row_count_expression } { ROW | ROWS } [ FETCH { FIRST | NEXT } {integer_constant | fetch_row_count_expression } { ROW | ROWS } ONLY ] }
SELECT * FROM BookTableThis SELECT statement returns the table in the same order as the rows that appear in the table.
SELECT * FROM BookTable ORDER BY AuthorThis statement uses the ORDER BY clause to sort the rows by the author's name
SELECT * FROM BookTable ORDER By Author, TitleThe ORDER BY clause will also sort multiple columns. To do this, simply separate the column names by a comma. The ORDER BY clause in this statement specifies that the results be sorted first by Author, then by Title.
SELECT * FROM BookTable ORDER BY Author ASC, Title DESCThe ORDER BY clause instructs the statement to sort the Author colum in ascending order and the Title column in descending order. The use of ASC is optional because ascending is the default sort order.