SQL/MP Installation and Management Guide
Understanding and Planning Database Tables
HP NonStop SQL/MP Installation and Management Guide—523353-004
3-14
Using Views
•
Reducing the overhead of returning unnecessary rows or columns, depending on
the selection criteria
•
Allowing the apparent structure of retrieved data to be different from the actual
stored data
•
Giving individual windows on the data to many users
•
Allowing logical renaming of columns
•
Redefining headings for columns
•
Redefining help text for columns
•
Presenting only the columns and rows a user must work with, instead of all the
columns and rows in the underlying table or tables
SQL/MP has two types of views: protection views and shorthand views.
Protection Views
A protection view is derived from a single table by taking a projection of the columns of
the table or a selection of the rows of the table, or both, and defining the view with the
PROTECTION attribute. Users can change the data in the underlying table through a
protection view if the view is updatable.
A protection view is updatable if the view includes all user-defined primary-key
columns of the underlying table, specified in a PRIMARY or CLUSTERING KEY
clause, and all columns are defined with NO DEFAULT. A protection view can be
secured for read, write, execute, and purge access.
Protection views provide several features that ensure the consistency of the data:
•
Protection against inserting rows that omit values for required columns
Rows of a protection view must include values for all the columns in the underlying
table that are defined with the NO DEFAULT option. If you violate this condition, an
SQL warning (4056) is issued when the view is created, and you cannot insert
rows into the view.
•
Protection against unauthorized access to the data
Only the local owner of a table or remote owner with authority to purge the table
can create a protection view on the table. Only the owner of the underlying table
can own the view.
Note. A view does not insulate the programs that use it from being invalidated because of
changes to the base table definition. Also, changes that do not directly affect the view require
that programs be explicitly SQL compiled to be revalidated. The requirement for explicit
compilation is the same for the programs used by the table directly.