What is ORDER BY statement used for in Microsoft SQL server?

Experience Level: Junior
Tags: DatabasesMS SQL ServerQuality Assurance (QA)

Answer

ORDER BY statement is used together with SELECT statement and defines by which columns the result-set is sorted.

The following query will sort the result-set by LastName and FirstName.

SELECT * FROM Customers ORDER BY LastName, FirstName

Related Databases job interview questions

Comments

No Comments Yet.
Be the first to tell us what you think.
MS SQL Server for Testers
MS SQL Server for Testers

Are you learning Databases ? Try our test we designed to help you progress faster.

Test yourself