SQL/MX 2.x Reference Manual (H06.04+)

SQL/MX Language Elements
HP NonStop SQL/MX Reference Manual540440-003
6-109
SQL/MX Views
An 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.
You cannot create a view that references both an SQL/MP table and an SQL/MX table.
SQL/MX Views
The distinction between protection and shorthand views does not exist for SQL/MX
views. To create a view, you must have SELECT privileges for the objects underlying
the view.
A views 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 more information about SQL/MX views, see CREATE VIEW Statement on
page 2-104 and DROP VIEW Statement on page 2-130.
SQL/MP Views
SQL/MP views are either protection views or shorthand views. A protection view is
derived from a single table and can be read, updated, and secured. A shorthand view
is derived from one or more tables or other views and inherits the security of the
underlying tables. A shorthand view can be read but not updated.
A view name must be a Guardian name.
For retrieval, you can use all views like base tables. Whether you can use a view in an
insert, update, or delete operation depends on its definition.
For more information about SQL/MP views, see Views in the SQL/MP Reference
Manual.
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 in the sample database:
EMPNUM FIRST_NAME LAST_NAME DEPTNUM JOBCODE
1 ROGER GREEN 9000 100
23 JERRY HOWARD 1000 100
75 TIM WALKER 3000 300
. . . . . . . . . . . . . . .