An codice_1 clause in SQL specifies that a SQL codice_2 statement returns a result set with the rows being sorted by the values of one or more columns. The sort criteria does not have to be included in the result set (restrictions apply for codice_3, codice_4, codice_5, codice_6 and codice_7.) The sort criteria can be expressions, including column names, user-defined functions, arithmetic operations, or codice_8 expressions. The expressions are evaluated and the results are used for the sorting, i.e., the values stored in the column or the results of the function call. codice_1 is the "only" way to sort the rows in the result set. Without this clause, the relational database system may return the rows in any order. If an ordering is required, the codice_1 must be provided in the codice_2 statement sent by the application. Although some database systems allow the specification of an codice_1 clause in subqueries or view definitions, the presence there has no effect on the final result-set order, but makes sense when combined with a result offset clause or a fetch first clause. A view is a logical relational table, and the relational model mandates that a table is a set of rows, implying no sort order whatsoever. The only exception are constructs like codice_13 (not standardized in ) which allow the propagation of sort criteria through nested subqueries. The SQL standard's core functionality does not explicitly define a default sort order for Nulls. With the extension T611, "Elementary OLAP operations", nulls can be sorted before or after all data values by using the codice_14 or codice_15 clauses of the codice_1 list, respectively. Not all DBMS vendors implement this functionality, however. Vendors who do not implement this functionality may specify different treatments for Null sorting in the DBMS. Structure codice_17 will order in descending order, otherwise ascending order is used. (The latter may be specified explicitly using codice_18.) Examples. SELECT * FROM Employees ORDER BY LastName, FirstName This sorts by the LastName column, then by the FirstName column if LastName matches.