Database Reference
In-Depth Information
whenever a query or other SQL command uses the view. The tables refer-
enced in the view's query are called
.
Views do not contain any data of their own, and therefore do not
require storage. Views belong to a schema, and you can grant privileges
such as SELECT, INSERT, UPDATE, and DELETE on views, even if the
user does not have any privileges on the base table(s) used in the view.
Views are most often used for security purposes and as an aid to query-
ing the database; however, some views can be used to insert, update, and
delete data in the underlying table.
base tables
19.2
Types and Uses of Views
Here are some of the more common reasons for creating a view:
Security
. Create a view with a limited subset of the rows and/or col-
umns in a table or tables and give the user permission to use the view,
but not the base tables.
Simplicity
. Create a view that combines tables that have complex
relationships so users writing queries do not need to understand the
relationships.
Complex Joins
. Sometimes queries cannot be done without great
difficulty unless you create a view in something like a temporary table
first. For example, you can create a view with a GROUP BY clause
that summarizes data. You can join that summary data with other
tables only by using a view.
Materialized Views
. This is not a view as such because the data in the
view is physically stored in the materialized view, thus the term
materi-
alized
. Materialized views are a little too specialized for this topic.
Regardless of why a view is created, it falls into one of three basic catego-
ries or types of views:
Simple View
. A simple view contains a query on a single table. For
example, a view that lists the names, addresses, and zip codes of all
artists in the USA is a simple view because only the ARTIST table is
queried in the view. Simple views can be used to narrow the focus or
visible data window of a specific user from the entire table to a subset
Search WWH ::




Custom Search