CREATE VIEW

Defines a view. Views are read only, so they do not support insert, update, delete, or copy operations.

Syntax

CREATE [ OR REPLACE ] VIEW view‑name [ (column‑name[,...]) ] 
  [ {INCLUDE|EXCLUDE} [SCHEMA] PRIVILEGES ] AS query

Parameters

OR REPLACE Specifies to overwrite the existing view view‑name. If you omit this option and view‑name already exists, CREATE VIEW returns an error.
view‑name Specifies the name of the view to create, where view‑name conforms to conventions described in Identifiers. view‑name must not be the name of an existing table, view, or projection.
column‑name[,...] A list of names to use as view column names. Vertica maps view column names to query columns according to the order of their respective lists. By default, the view uses column names as they are specified in the query. Each view can contain up to 1600 columns.
query

A SELECT statement that the temporary view executes. The SELECT statement can reference tables, temporary tables, and other views.

{INCLUDE|EXCLUDE}[SCHEMA] PRIVILEGES

Specifies whether this view inherits schema privileges:

  • INCLUDE PRIVILEGES: Inherit schema privileges.
  • EXCLUDE PRIVILEGES: Do not inherit schema privileges.

For details, see Grant Inherited Privileges.

Privileges

See Creating Views

Examples

The following example shows how to create a view that contains data from multiple tables.

=> CREATE VIEW temp_t0 AS SELECT * from t0_p1 UNION ALL 
     SELECT * from t0_p2 UNION ALL 
       SELECT * from t0_p3 UNION ALL 
         SELECT * from t0_p4 UNION ALL 
           SELECT * from t0_p5;			

See Also