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
Leave a Reply