Sorting Archives

In SQL query results are sorted using the ORDER BY clause.  This page is devoted to articles covering various aspects of sorting, such as how to get the top rows in a result, and ways to fetch results from the “middle” of a result.

If you’re new to SQL, I would recommend reading Getting Started With SQL Server: 2. Sort Your Query Results.

I would also recommend the following, once you have the basics mastered:

All the examples for this lesson are based on Microsoft SQL Server Management Studio and the sample databases AdventureWorks and WideWorldImporters.  You can get started using these free tools using my guide Getting Started Using SQL Server

>