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