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

SQL/MX Language Elements
HP NonStop SQL/MX Reference Manual540440-003
6-108
Triggers
An SQL/MX table is described in an SQL/MX schema and stored in a physical file in
the Guardian environment. An SQL/MX table name can be a fully qualified ANSI name
of the form catalog-name.schema-name.object-name.
Base Tables and Views
In some descriptions of SQL, tables created with a CREATE TABLE statement are
referred to as base tables to distinguish them from views, which are referred to as
logical tables.
A view is a named logical table defined by a query specification that uses one or more
base tables or other views. See Views on page 6-108.
Example of a Base Table
For example, this EMPLOYEE table is a base table in the sample database:
In this sample table, the columns are EMPNUM, FIRST_NAME, LAST_NAME,
DEPTNUM, JOBCODE, and SALARY. The values in each column have the same data
type.
See Tables in the SQL/MP Reference Manual.
Triggers
A trigger is a mechanism that resides in the database and specifies that when a
particular action—an insert, delete, or update—occurs on a particular table,
NonStop SQL/MX should automatically perform one or more additional actions.
For a complete description of triggers and their use, see Considerations for CREATE
TRIGGER on page 2-97. See also CREATE TRIGGER Statement on page 2-95,
ALTER TRIGGER Statement on page 2-24, DROP TRIGGER Statement on
page 2-129, SET Statement on page 2-207, and SIGNAL SQLSTATE Statement on
page 2-222.
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.
EMPNUM FIRST_NAME LAST_NAME DEPTNUM JOBCODE SALARY
1 ROGER GREEN 9000 100 175500.00
23 JERRY HOWARD 1000 100 137000.00
75 TIM WALKER 3000 300 32000.00
. . . . . . . . . . . . . . . . . .