Order By
ORDER BY sorts the results, ascending (ASC, the default) or descending (DESC), by one or more fields, expressions or aggregate functions.
Notes on result limiters
When using Top or Offset, the ORDER BY is applied before the rows are limited.SELECT Id, Text, LanguageId FROM WordList:Word WHERE Text LIKE 'Summar%' ORDER BY TextSELECT
Id, Text, LanguageId
FROM
WordList:Word
ORDER BY
LanguageId ASC,
Text DESCSELECT Text FROM WordList:Word WHERE LanguageId = 1 ORDER BY Length(Text) DESCSELECT LanguageId, Count(0) as Words FROM WordList:Word GROUP BY LanguageId ORDER BY Count(0) DESCSQL :: Sum
Returns the total of the values in each group.
SQL :: Top
The TOP keyword limits the number of results that are returned by a query.
SQL :: Variance
Returns the population variance of the values in each group: how far the values are spread from their mean.