SQL/MP Reference Manual
HP NonStop SQL/MP Reference Manual—523352-013
C-172
Examples—CREATE VIEW
This statement creates a view that joins the CUSTOMER and ORDERS tables in a
better way than in the previous example. The CREATE VIEW statement uses a
WHERE clause to join the two tables only at rows in which CUSTNUM values are
equal. The view can never contain more rows than the number of rows in the
largest table.
CREATE VIEW GOOD
(C_CUSTNUM,O_CUSTNUM,CUSTNAME,STATE,ORDERNUM)
AS SELECT C.CUSTNUM,O.CUSTNUM,CUSTNAME,STATE,ORDERNUM
FROM SALES.CUSTOMER C, SALES.ORDERS O
WHERE C.CUSTNUM = O.CUSTNUM CATALOG SALES;
For information about join methods, see Joins on page J-1 or the SQL/MP Query
Guide.