Database Reference
In-Depth Information
19
Views
In this chapter:
What is a view?
What types of views are available?
How do we use views?
What are metadata views?
There are various examples of views in other chapters. This chapter
describes views in detail. A view is an overlay onto one or more other data
sources. A data source can be a table, view, or multiples thereof.
19.1
What Is a View?
Imagine that you are working in an insurance company, where part of your
job duties are to help users who have trouble writing queries for reports.
The users have had basic training in writing SQL queries, but they often get
stuck when they must join many tables or use subqueries. If you could set
up the join or subquery ahead of time, then the users would have no trou-
ble adding to it to refine their report requirements. This is one of the best
reasons to create a view.
Note:
This approach can, however, be bad for performance because the
entire query in the view will always be executed, whatever filtering is placed
1
on a query against a view.
is a query that is stored in the database and executed to create a
virtual table. A view is given a name, is owned by a schema, and is executed
A
view
Search WWH ::




Custom Search