CREATE VIEW v11
CREATE VIEW -- define a new view.
CREATE VIEW defines a view of a query. The view is not physically materialized. Instead, the query is run every time the view is referenced in a query.
CREATE OR REPLACE VIEW is similar, but if a view of the same name already exists, it is replaced.
If a schema name is given (for example,
CREATE VIEW myschema.myview ...) then the view is created in the specified schema. Otherwise it is created in the current schema. The view name must be distinct from the name of any other view, table, sequence, or index in the same schema.
The name (optionally schema-qualified) of a view to be created.
An optional list of names to be used for columns of the view. If not given, the column names are deduced from the query.
A query (that is, a
SELECT statement) which will provide the columns and rows of the view.
SELECT for more information about valid queries.
Currently, views are read only - the system will not allow an insert, update, or delete on a view. You can get the effect of an updatable view by creating rules that rewrite inserts, etc. on the view into appropriate actions on other tables.
Access to tables referenced in the view is determined by permissions of the view owner. However, functions called in the view are treated the same as if they had been called directly from the query using the view. Therefore the user of a view must have permissions to call all functions used by the view.
Create a view consisting of all employees in department