December 2008
Intermediate to advanced
318 pages
7h 26m
English
ORDER BY ClauseIn this chapter, we’ll look at the ORDER BY clause, the last of the clauses of the SELECT SQL statement.[6] Not only is ORDER BY the last clause in the syntax, it’s also the last clause in the execution sequence. Fortunately, ORDER BY is a really simple clause, so let’s jump right in.
The purpose of the ORDER BY clause is to ensure that the result set produced by the query is returned in the specified sequence. Simply, ORDER BY sorts the results. (Personally, I think SORT BY might have been a better keyword, but it’s ORDER BY and we just have to live with it.)
ORDER BY SyntaxLike the SELECT clause, the ORDER BY clause has very simple syntax:
ORDER BY column [ASC | DESC] [, column [ASC | DESC]] …
Read now
Unlock full access