15.10 - CREATE VIEW and REPLACE VIEW - Teradata Database

Teradata Database SQL Data Definition Language Syntax and Examples

prodname
Teradata Database
vrm_release
15.10
created_date
December 2015
category
Programming Reference
featnum
B035-1144-151K

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 ANSI Temporal Table Support, B035-1186 and 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.

Immediate Owner of View? Privileges Required
Yes
  • UPDATE on the view.
  • UPDATE on the table.
No
  • 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:

Immediate Owner of View? Privileges Required
Yes
  • DELETE on the view.
  • DELETE on the table.
No
  • 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:

Immediate Owner of View? Privileges Required
Yes
  • SELECT ACCESS on the view.
  • SELECT ACCESS on the table.
No
  • 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 in CREATE VIEW and REPLACE VIEW, 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