The CREATE VIEW statement is used to create a view.

CREATE VIEW view_name AS select_stmt

Parameters

  • view_name: the name of the view you want to create. You can prefix a database name to the view name to distinguish between the views that have the same name but belong to different databases.

  • select_stmt: the data source of the view.

Example

When data of the finished_orders table in the tpch schema is used as the data source, you can execute the following statement to create the finished_orders_v1 view:

CREATE VIEW tpch.finished_orders_v1 AS SELECT * FROM finished_orders;