SQL Reference
Data Definition Language (DDL)...
Views
this group of ddl sql statements allows database administrators to manage views database administrators can create, modify, drop, and export views you can view information about views using the sys views system catalog table for information on database components, see the pages on docid\ uy5crlqbr0ymvtqzwna6x , docid\ m9zbpvfqpm96jidxyhqvi , docid\ yhp4b1irv haf8f3df ww , and docid\ n7zyxmwfavae6fnmv2uvw create view create view creates a new view in the current database or replaces an existing view for view creation, the name of the view must be distinct from the name of any existing views in the database to create a view, you must have both the create view privilege for the current database and the select privilege on all directly referenced tables and views in the query you must have drop privileges on the view you also must have create view privileges on the database syntax create \[ or replace ] view \[ if not exists ] view name as query parameter type description view name string a distinct identifier used to name the view query string a select query that defines the data from a table used to create the view example this example creates an existing view in the current database and schema named option trades create view option trades as select from trades where type = 'options'; drop view drop view removes one or more existing views in the current database to remove a view, you must have the drop view privilege for the view syntax drop view \[ if exists ] view name \[, ] parameter type description view name string the identifier of the view to drop you can drop multiple views by specifying additional view names and separating each with commas example this example drops an existing view in the current database and schema named star employees drop view star employees; this example drops two views named star employees and bad employees drop view star employees, bad employees; alter view rename alter view rename renames an existing view required privileges to rename a view, you must have the alter view privilege for the view the {{ocient}} system requires these privileges if this statement includes a change to the schema view privilege on the current schema of the view view view and create view privileges on the target schema (if the schema already exists) create view privilege on the database (if the schema does not exist) syntax alter view \[ if exists ] old view name rename to new view name parameter type description old view name string the identifier of the view to rename new view name string the new name for the specified view examples this example renames an existing view in the current database and schema named star employees to star mid west employees alter view star employees rename to star mid west employees; this example renames an existing view in the current database named us star employees to us star mid west employees alter view us star employees rename to us star mid west employees; alter view as alter view as modifies an inner query of the existing view to modify the query for an existing view, you must be a system level user or have the alter view privilege for the view you must also have the select privilege on all referenced tables and views in the new query syntax alter view \[ if exists ] view name as query parameter type description view name string the identifier for the view to alter query string a select query that defines the new data from a table used to alter the view example this example alters a view in the current database and schema named star employees alter view star employees as select from sys tables; export view export view shows the create view statement for an existing view in the current database to export a view, the logged in user must be a system level user or have the read view right for the view syntax export view view name parameter type description view name string the identifier for the view to export example this example exports an existing view in the current database and schema named students export view students; related links docid nwuyof4 i 7wgmmmbf4j docid\ nw9vavkey2v75moxm muo docid\ jfltms91v2bfledppksy8 https //docs ocient com/system catalog