16.20 - CREATE VIEW and REPLACE VIEW - Teradata Database - Teradata Vantage NewSQL Engine

Teradata Vantage™ SQL Data Definition Language Syntax and Examples

Product
Teradata Database
Teradata Vantage NewSQL Engine
Release Number
16.20
Published
March 2019
Content Type
Programming Reference
Publication ID
B035-1144-162K
Language
English (United States)
Last Update
2019-05-24

Purpose

Creates or replaces a view on a set of tables or views or both.

REPLACE VIEW redefines an existing view or, if the specified view does not exist, creates a new view with the specified name. Privileges that were granted directly on the original view are retained for the replace view definition. You can archive, copy, and restore individual view definitions. See Teradata® Archive/Recovery Utility Reference, B035-2412.

For information about the temporal forms of CREATE VIEW and REPLACE VIEW, see Teradata Vantage™ ANSI Temporal Table Support , B035-1186 and Teradata Vantage™ Temporal Table Support , B035-1182 .

Required Privileges: CREATE VIEW

To create a view, you must have the CREATE VIEW privilege.

The creator receives the DROP VIEW, INSERT, UPDATE, DELETE, and SELECT privileges on the newly created view WITH GRANT OPTION.

If a user other than the owner accesses a view, then all of the relevant privileges needed by the immediate owner of the view to access underlying tables and views must also be held by the immediate owner of the view WITH GRANT OPTION.

You must have the following privileges to update a table through a view.

User Privileges Required
Immediate owner of view
  • UPDATE on the view.
  • UPDATE on the table.
Other users
  • UPDATE on the view.
  • UPDATE WITH GRANT OPTION on the table.

You must have the following privileges to delete rows from a table through a view:

User Privileges Required
Immediate owner of view
  • DELETE on the view.
  • DELETE on the table.
Other users
  • DELETE on the view.
  • DELETE WITH GRANT OPTION on the table.

You must have the following privileges to update or delete rows from a table using a search condition through a view:

User Privileges Required
Immediate owner of view
  • SELECT ACCESS on the view.
  • SELECT ACCESS on the table.
Other users
  • SELECT ACCESS on the view.
  • SELECT ACCESS WITH GRANT OPTION on the objects specified in the search condition list.

Required Privileges: REPLACE VIEW

You must have the relevant privileges listed above, as well as the following additional privileges to replace a view:
  • DROP VIEW privilege.
  • CREATE VIEW privilege if the specified view does not exist.

Privileges Granted Automatically

When you create a new view, the following privileges are automatically granted to the view:
  • DELETE
  • DROP VIEW
  • GRANT
  • INSERT
  • SELECT
  • UPDATE

Syntax