Skip to main content

DROP VIEW

Removes a view.


Syntax

DROP VIEW [IF EXISTS] <name> [, ...] [CASCADE | RESTRICT]

Description

To run this command, you must own the view.


Parameters

  • IF EXISTS

    If you include IF EXISTS in your command, no error will be reported when the specified view does not exist. A notice will be issued instead.

  • <name>

    The name of the view. You can prefix the name with a schema name to delete the view from the specified schema.

  • CASCADE or RESTRICT

    Whether to drop the view and its dependent objects if dependent objects exist. Supported options include:

    • CASCADE: specifies to drop the dependent objects along with the view.
    • RESTRICT: specifies to reject the drop operation and is the default.

Examples

Drop view myview:

DROP VIEW myview;

SQL standard compatibility

DROP VIEW in Relyt is fully compatible to DROP VIEW in the SQL standard, and DROP VIEW in Relyt provides the following extensions:

  • Allows you to drop more than one view in a single command.
  • Allows you to use the IF EXISTS option.