SQL ORDER BY Clause

Published on by LakshmiSaahul,Dhana Royal

SQL ORDER BY Clause

ORDER BY clause is used to sort the data in ascending or descending order, in SQL Server bydefault data will not be inserted in any order even if you have an index.

Syntax:

SELECT expressions
FROM tables
WHERE conditions
ORDER BY expression [ ASC | DESC ];

We will take an example of table [Person] to sort the column order by FirstName in ascending order.

SELECT

[FirstName]

,[MiddleName]

,[LastName]

FROM [Person].[Person]

ORDER BY FirstName;

Advertising
To be informed of the latest articles, subscribe:
Comment on this post