Neoview SQL Reference Manual (R2.2)

CREATE VIEW Statement
“Syntax Description of CREATE VIEW”
“Considerations for CREATE VIEW”
“Examples of CREATE VIEW”
The CREATE VIEW statement creates a Neoview SQL view. See “Views” (page 254).
CREATE VIEW view
[(column-name ] [,column-name ...)]
AS query-expr
[WITH [CASCADED] CHECK OPTION]
query-expr is:
non-join-query-expr | joined-table
non-join-query-expr is:
non-join-query-primary | query-expr UNION [ALL] query-term
query-term is:
non-join-query-primary | joined-table
non-join-query-primary is:
simple-table | (non-join-query-expr)
joined-table is:
table-ref [NATURAL] [join-type] JOIN table-ref [join-spec]
join-type is:
INNER | LEFT [OUTER] | RIGHT [OUTER]
join-spec is:
ON condition
simple-table is:
VALUES (row-value-const) [,(row-value-const)]...
| TABLE table
| SELECT [ALL | DISTINCT] select-list
FROM table-ref [,table-ref]...
[WHERE search-condition]
[SAMPLE sampling-method]
[TRANSPOSE transpose-set [transpose-set]...
[KEY BY key-colname]]...
[SEQUENCE BY colname [ASC[ENDING] | DESC[ENDING]]
[,colname [ASC[ENDING] | DESC[ENDING]]]...]
[GROUP BY {colname | colnum} [,{colname | colnum}]...]
[HAVING search-condition]
row-value-const is:
row-subquery | expression [,expression]...
Syntax Description of CREATE VIEW
view
specifies the name for the view to create. See “Database Object Names” (page 196).
(column-name [,column-name ]...)
specifies names for the columns of the view and, optionally, headings for the columns. Column
names in the list must match one-for-one with columns in the table specified by query-expr.
If you omit this clause, columns in the view have the same names as the corresponding
columns in query-expr. You must specify this clause if any two columns in the table
specified by query-expr have the same name or if any column of that table does not have
a name. For example, this query expression SELECT MAX(salary), AVG(salary) AS
average_salary FROM employee the first column does not have a name.
CREATE VIEW Statement 87