<s>
In	O
a	O
database	O
,	O
a	O
view	O
is	O
the	O
result	B-Application
set	I-Application
of	O
a	O
stored	O
query	B-Language
,	O
which	O
can	O
be	O
queried	O
in	O
the	O
same	O
manner	O
as	O
a	O
persistent	O
database	O
collection	O
object	O
.	O
</s>
<s>
This	O
pre-established	O
query	B-Language
command	O
is	O
kept	O
in	O
the	O
database	O
dictionary	O
.	O
</s>
<s>
Unlike	O
ordinary	O
base	O
tables	O
in	O
a	O
relational	B-Application
database	I-Application
,	O
a	O
view	O
does	O
not	O
form	O
part	O
of	O
the	O
physical	B-General_Concept
schema	I-General_Concept
:	O
as	O
a	O
result	B-Application
set	I-Application
,	O
it	O
is	O
a	O
virtual	O
table	O
computed	O
or	O
collated	O
dynamically	O
from	O
data	O
in	O
the	O
database	O
when	O
access	O
to	O
that	O
view	O
is	O
requested	O
.	O
</s>
<s>
Consequently	O
,	O
a	O
view	O
can	O
limit	O
the	O
degree	O
of	O
exposure	O
of	O
the	O
underlying	O
tables	O
to	O
the	O
outer	O
world	O
:	O
a	O
given	O
user	O
may	O
have	O
permission	O
to	O
query	B-Language
the	O
view	O
,	O
while	O
denied	O
access	O
to	O
the	O
rest	O
of	O
the	O
base	O
table	O
.	O
</s>
<s>
Views	O
can	O
join	B-Language
and	O
simplify	O
multiple	O
tables	O
into	O
a	O
single	O
virtual	O
table	O
.	O
</s>
<s>
Views	O
can	O
act	O
as	O
aggregated	O
tables	O
,	O
where	O
the	O
database	B-General_Concept
engine	I-General_Concept
aggregates	O
data	O
(	O
sum	O
,	O
average	O
,	O
etc	O
.	O
)	O
</s>
<s>
For	O
example	O
,	O
a	O
view	O
could	O
appear	O
as	O
Sales2000	O
or	O
Sales2001	O
,	O
transparently	O
partitioning	B-General_Concept
the	O
actual	O
underlying	O
table	O
.	O
</s>
<s>
Depending	O
on	O
the	O
SQL	B-Language
engine	O
used	O
,	O
views	O
can	O
provide	O
extra	O
security	O
.	O
</s>
<s>
Just	O
as	O
a	O
function	O
(	O
in	O
programming	O
)	O
can	O
provide	O
abstraction	B-Application
,	O
so	O
can	O
a	O
database	B-Language
view	I-Language
.	O
</s>
<s>
Without	O
the	O
use	O
of	O
views	O
,	O
the	O
normalization	B-Application
of	O
databases	B-Application
above	O
second	O
normal	B-Application
form	I-Application
would	O
become	O
much	O
more	O
difficult	O
.	O
</s>
<s>
Views	O
can	O
make	O
it	O
easier	O
to	O
create	O
lossless	O
join	B-Language
decomposition	O
.	O
</s>
<s>
Just	O
as	O
rows	B-Application
in	O
a	O
base	O
table	O
lack	O
any	O
defined	O
ordering	O
,	O
rows	B-Application
available	O
through	O
a	O
view	O
do	O
not	O
appear	O
with	O
any	O
default	O
sorting	O
.	O
</s>
<s>
A	O
view	O
is	O
a	O
relational	O
table	O
,	O
and	O
the	O
relational	O
model	O
defines	O
a	O
table	O
as	O
a	O
set	O
of	O
rows	B-Application
.	O
</s>
<s>
Since	O
sets	O
are	O
not	O
ordered	O
by	O
definition	O
neither	O
are	O
the	O
rows	B-Application
of	O
a	O
view	O
.	O
</s>
<s>
Therefore	O
,	O
an	O
ORDER	B-Language
BY	I-Language
clause	O
in	O
the	O
view	O
definition	O
is	O
meaningless	O
;	O
the	O
SQL	B-Language
standard	O
(	O
SQL:2003	B-Language
)	O
does	O
not	O
allow	O
an	O
ORDER	B-Language
BY	I-Language
clause	O
in	O
the	O
subquery	O
of	O
a	O
CREATE	O
VIEW	O
command	O
,	O
just	O
as	O
it	O
is	O
refused	O
in	O
a	O
CREATE	O
TABLE	O
statement	O
.	O
</s>
<s>
However	O
,	O
sorted	O
data	O
can	O
be	O
obtained	O
from	O
a	O
view	O
,	O
in	O
the	O
same	O
way	O
as	O
any	O
other	O
table	O
as	O
part	O
of	O
a	O
query	B-Language
statement	O
on	O
that	O
view	O
.	O
</s>
<s>
Nevertheless	O
,	O
some	O
DBMS	O
(	O
such	O
as	O
Oracle	B-General_Concept
Database	I-General_Concept
)	O
do	O
not	O
abide	O
by	O
this	O
SQL	B-Language
standard	O
restriction	O
.	O
</s>
<s>
If	O
the	O
database	B-Application
system	I-Application
can	O
determine	O
the	O
reverse	O
mapping	O
from	O
the	O
view	O
schema	O
to	O
the	O
schema	O
of	O
the	O
underlying	O
base	O
tables	O
,	O
then	O
the	O
view	O
is	O
updatable	O
.	O
</s>
<s>
INSERT	B-Language
,	O
UPDATE	B-Language
,	O
and	O
DELETE	B-Language
operations	O
can	O
be	O
performed	O
on	O
updatable	O
views	O
.	O
</s>
<s>
A	O
view	O
update	B-Language
is	O
done	O
by	O
key	O
preservation	O
.	O
</s>
<s>
Some	O
systems	O
support	O
the	O
definition	O
of	O
INSTEAD	O
OF	O
triggers	B-Language
on	O
views	O
.	O
</s>
<s>
This	O
technique	O
allows	O
the	O
definition	O
of	O
other	O
logic	O
for	O
execution	O
in	O
place	O
of	O
an	O
insert	B-Language
,	O
update	B-Language
,	O
or	O
delete	B-Language
operation	O
on	O
the	O
views	O
.	O
</s>
<s>
Thus	O
database	B-Application
systems	I-Application
can	O
implement	O
data	O
modifications	O
based	O
on	O
read-only	O
views	O
.	O
</s>
<s>
Various	O
database	B-Application
management	I-Application
systems	I-Application
have	O
extended	O
the	O
views	O
from	O
read-only	O
subsets	O
of	O
data	O
,	O
particularly	O
materialized	B-Application
views	I-Application
:	O
pre-executed	O
,	O
non-virtual	O
views	O
commonly	O
used	O
in	O
data	O
warehousing	O
.	O
</s>
<s>
The	O
accuracy	O
of	O
a	O
materialized	B-Application
view	I-Application
depends	O
on	O
the	O
frequency	O
of	O
trigger	O
mechanisms	O
behind	O
its	O
updates	O
.	O
</s>
<s>
Materialized	B-Application
views	I-Application
were	O
introduced	O
by	O
Oracle	B-General_Concept
Database	I-General_Concept
,	O
while	O
IBM	B-Application
Db2	I-Application
provides	O
so-called	O
"	O
materialized	B-Application
query	I-Application
tables	I-Application
"	O
(	O
MQTs	O
)	O
for	O
the	O
same	O
purpose	O
.	O
</s>
<s>
Microsoft	B-Application
SQL	I-Application
Server	I-Application
introduced	O
in	O
its	O
2000	O
version	O
indexed	O
views	O
which	O
only	O
store	O
a	O
separate	O
index	O
from	O
the	O
table	O
,	O
but	O
not	O
the	O
entire	O
data	O
.	O
</s>
<s>
PostgreSQL	B-Application
implemented	O
materialized	B-Application
views	I-Application
in	O
its	O
9.3	O
release	O
.	O
</s>
<s>
A	O
view	O
is	O
equivalent	O
to	O
its	O
source	O
query	B-Language
.	O
</s>
<s>
When	O
queries	B-Language
are	O
run	O
against	O
views	O
,	O
the	O
query	B-Language
is	O
modified	O
.	O
</s>
<s>
then	O
the	O
application	O
could	O
run	O
a	O
simple	O
query	B-Language
such	O
as	O
:	O
</s>
<s>
The	O
RDBMS	O
then	O
takes	O
the	O
simple	O
query	B-Language
,	O
replaces	O
the	O
equivalent	O
view	O
,	O
then	O
sends	O
the	O
following	O
to	O
the	O
query	B-Language
optimizer	I-Language
:	O
</s>
<s>
The	O
optimizer	O
then	O
removes	O
unnecessary	O
fields	O
and	O
complexity	O
(	O
for	O
example	O
it	O
is	O
not	O
necessary	O
to	O
read	O
the	O
address	O
,	O
since	O
the	O
parent	O
invocation	O
does	O
not	O
make	O
use	O
of	O
it	O
)	O
and	O
then	O
sends	O
the	O
query	B-Language
to	O
the	O
SQL	B-Language
engine	O
for	O
processing	O
.	O
</s>
