HOW TO USE SQL ORDER BY CLAUSE?

817 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

Ganesh Ji Arti A Tribute to Dilip Kumar