






















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!























Silicon Valley University
View Definition
Materialized
View
Indexes
Declare by:
Default is virtual.
CanDrink(drinker, beer) is a view
“containing” the drinker-beer pairs such
that the drinker frequents at least one
bar that serves the beer:
CREATE VIEW CanDrink AS
SELECT drinker, beer
FROM Frequents, Sells
WHEREFrequents.bar = Sells.bar;
the staff view does not show the
salary or commission_pct columns
of the base table employees
7
8
A single view can be defined with a
join, which is a collection of related
columns or rows in multiple tables
However, the view hides the fact that this
information actually originates from several
tables
A query might also perform
extensive calculations with
table information
Thus, users can query a view without
knowing how to perform a join or
calculations
1
Present the data in a different
perspective from that of the base
table
For example, the columns of a view
can be renamed without affecting
the tables on which the view is
based
Isolate applications from
changes in definitions of base
tables
Example
A view references three columns of
a four column table
A fifth column is added to the table
The definition of the view is not
affected
All applications using the view
1
1
1
1
Materialized views are query results that
have been stored or "materialized" in
advance as schema objects
The FROM clause of the query can
name tables, views, and
materialized views
Collectively these objects are called
master tables (a replication term) or
detail tables (a data warehousing
term)
Then queries
1
The query selects data because
the rows are stored
(materialized) separately from
the data in the master tables
1
1
Materialized views are used to
summarize, compute,
replicate, and distribute data
In data warehouses, you can use
materialized views to compute
and store data generated from
aggregate functions such as
sums and averages
2
0
Wal-Mart stores every sale at
every store in a database.
Overnight, the sales for the day
views of the sales.
The warehouse is used by
analysts to predict trends and
move goods to where they are
selling best.