Decode Analytics

View Original

Order By

ORDER BY sorts the result set by one or more columns.

The ORDER BY keyword sorts the records in ascending order by default or you can use the ASC keyword.

To sort records in descending order use the DESC keyword.


SQL ORDER BY Syntax:

SELECT

Column1,

Column2,

Column3

FROM Table_Name

ORDER BY Column1, Column2  ASC|DESC


Example:

Lets use the “Products” table to select all of the products and order them by price in descending order.

See this content in the original post

Results:

See this content in the original post

SQL Tutorial

See this content in the original post