Views; Sql Views; Example Of A View; Mvgroups - HP Neoview SQL Reference Manual

Hide thumbs Also See for Neoview SQL:
Table of Contents

Advertisement

Views

A view provides an alternate way of looking at data in one or more tables. A view is a named
specification of a result table, which is a set of rows selected or generated from one or more base
tables or other views. The specification is a SELECT statement that is executed whenever the
view is referenced.
A view is a logical table created with the CREATE VIEW statement and derived by projecting a
subset of columns, restricting a subset of rows, or both, from one or more base tables or other
views.

SQL Views

To create a view, you must have SELECT privileges for the objects underlying the view.
A view's name must be unique among table and view names within the schema that contains it.
You cannot create views with names prefixed by the name of a user metadata table. For example,
you cannot create a view named HISTOGRAMS_MYVIEW.
Single table views are updatable. Multitable views are not updatable.
For information about SQL views, see
Statement" (page

Example of a View

You can define a view to show only part of the data in a table. For example, this EMPLIST view
is defined as part of the EMPLOYEE table:
EMPNUM
1
23
75
. . .
In this sample view, the columns are EMPNUM, FIRST_NAME, LAST_NAME, DEPTNUM, and
JOBCODE. The SALARY column in the EMPLOYEE table is not part of the EMPLIST view.

MVGROUPs

An MVGROUP is a group of materialized views that are refreshed together. One way to group
MVs is by the frequency of the REFRESH (for example, each day, each week, each month).
Another way is to create groups to preserve consistency, that is, to group all the MVs on common
tables.
An MV can be added to an MVGROUP only when it satisfies at least one of these conditions:
all the MVs that are used by it, directly or indirectly, are also in the group
the MV is single-delta
This ensures that every MV in the group is consistent with a well-defined state of the database
tables after a REFRESH. A single-delta MV is defined as an ON REQUEST MV that can be
refreshed based on changes (delta) to a single table. A single-delta MV must satisfy the
requirement that the MV is based either on a single table (base table or MV) or on a join where
only one of the base tables is not included in the IGNORE CHANGES clause.
MVGROUPS are automatically created for every table used by MVs. Those MVGROUPS have
the same name as their corresponding base table. As MVs are created, they are automatically
added to the MVGROUP of their corresponding base tables. To refresh all the MVs on a specific
base table, use the
254
SQL Language Elements
"CREATE VIEW Statement" (page 87)
100).
FIRST_NAME
LAST_NAME
ROGER
GREEN
JERRY
HOWARD
TIM
WALKER
. . .
. . .
"MAINTAIN Command" (page
DEPTNUM
9000
1000
3000
. . .
182).
and
"DROP VIEW
JOBCODE
100
100
300
. . .

Advertisement

Table of Contents
loading

Table of Contents