Skip to main content
Creates a new virtual table from the given query.
CREATE VIEW Syntax
When any of the source tables of a view is altered or dropped, the view will also be dropped.
A CREATE OR REPLACE issues an implicit drop, so replacing an input table will have the same effect on the view as dropping it.

Parameters

OR REPLACE

Any existing table/view with the same name will be dropped before creating this view

<schema name>

Name of the schema that will contain the created view; if no schema is specified, the view will be created in the user’s default schema

<view name>

Name of the view to create; must adhere to the supported naming criteria

<select statement>

The query that will define both the structure and content of the created view

Examples

To create a view that is a copy of an existing table, failing if a table or view with the same name as the target view already exists:
CREATE VIEW Example