<s>
An	O
ORDER	B-Language
BY	I-Language
clause	O
in	O
SQL	B-Language
specifies	O
that	O
a	O
SQL	B-Language
SELECT	I-Language
statement	O
returns	O
a	O
result	B-Application
set	I-Application
with	O
the	O
rows	O
being	O
sorted	O
by	O
the	O
values	O
of	O
one	O
or	O
more	O
columns	O
.	O
</s>
<s>
The	O
sort	O
criteria	O
do	O
not	O
have	O
to	O
be	O
included	O
in	O
the	O
result	B-Application
set	I-Application
.	O
</s>
<s>
The	O
sort	O
criteria	O
can	O
be	O
expressions	O
,	O
including	O
column	O
names	O
,	O
user-defined	B-Language
functions	I-Language
,	O
arithmetic	O
operations	O
,	O
or	O
CASE	O
expressions	O
.	O
</s>
<s>
ORDER	B-Language
BY	I-Language
is	O
the	O
only	O
way	O
to	O
sort	O
the	O
rows	O
in	O
the	O
result	B-Application
set	I-Application
.	O
</s>
<s>
Without	O
this	O
clause	O
,	O
the	O
relational	O
database	B-Application
system	I-Application
may	O
return	O
the	O
rows	O
in	O
any	O
order	O
.	O
</s>
<s>
If	O
an	O
ordering	O
is	O
required	O
,	O
the	O
ORDER	B-Language
BY	I-Language
must	O
be	O
provided	O
in	O
the	O
SELECT	B-Language
statement	O
sent	O
by	O
the	O
application	O
.	O
</s>
<s>
Although	O
some	O
database	B-Application
systems	I-Application
allow	O
the	O
specification	O
of	O
an	O
ORDER	B-Language
BY	I-Language
clause	O
in	O
subselects	O
or	O
view	B-Language
definitions	O
,	O
the	O
presence	O
there	O
has	O
no	O
effect	O
.	O
</s>
<s>
A	O
view	B-Language
is	O
a	O
logical	O
relational	O
table	O
,	O
and	O
the	O
relational	B-Architecture
model	I-Architecture
mandates	O
that	O
a	O
table	O
is	O
a	O
set	O
of	O
rows	O
,	O
implying	O
no	O
sort	O
order	O
whatsoever	O
.	O
</s>
<s>
The	O
only	O
exception	O
are	O
constructs	O
like	O
ORDER	B-Language
BY	I-Language
ORDER	O
OF	O
...	O
(	O
not	O
standardized	O
in	O
SQL:2003	B-Language
)	O
which	O
allow	O
the	O
propagation	O
of	O
sort	O
criteria	O
through	O
nested	O
subselects	O
.	O
</s>
<s>
The	O
SQL	B-Language
standard	O
's	O
core	O
functionality	O
does	O
not	O
explicitly	O
define	O
a	O
default	O
sort	O
order	O
for	O
Nulls	B-Language
.	O
</s>
<s>
With	O
the	O
SQL:2003	B-Language
extension	O
T611	O
,	O
"	O
Elementary	O
OLAP	O
operations	O
"	O
,	O
nulls	B-Language
can	O
be	O
sorted	O
before	O
or	O
after	O
all	O
data	O
values	O
by	O
using	O
the	O
NULLS	B-Language
FIRST	O
or	O
NULLS	B-Language
LAST	O
clauses	O
of	O
the	O
ORDER	B-Language
BY	I-Language
list	O
,	O
respectively	O
.	O
</s>
<s>
Vendors	O
who	O
do	O
not	O
implement	O
this	O
functionality	O
may	O
specify	O
different	O
treatments	O
for	O
Null	B-Language
sorting	O
in	O
the	O
DBMS	O
.	O
</s>
<s>
Structure	O
ORDER	B-Language
BY	I-Language
...	O
DESC	O
will	O
order	O
in	O
descending	O
order	O
,	O
otherwise	O
ascending	O
order	O
is	O
used	O
.	O
</s>
