HOW TO USE SQL ORDER BY CLAUSE?

753 viewsSQLSQL
0

HOW TO USE SQL ORDER BY CLAUSE?

Saraswat World Changed status to publish June 14, 2023
0
ORDER BY in SQL
ORDER BY in SQL
ORDER BY CLAUSE

ORDER BY keyword sorts the records in ascending order by default. To sort the records in descending order, use the DESC keyword.

Syntaxย to sort the records in ascending order:

SELECTย ColumnName1,โ€ฆ,ColumnNameN

FROMย <TableName>

ORDER BYย <ColumnName>ย ASC;

 

Syntaxย to sort the records in descending order:

SELECTย ColumnName1,โ€ฆ,ColumnNameN

FROMย <TableName>

ORDER BYย <ColumnName>DESC;

 

Syntaxย to sort the records in ascending order without using ASC keyword:

SELECTย ColumnName1,โ€ฆ,ColumnNameN

FROMย <TableName >

ORDER BYย <ColumnName>;

Saraswat World Changed status to publish June 14, 2023
Write your answer.

Posted

in

Tags:

Comments

Leave a Reply

A Tribute to Dilip Kumar