Skip to content

DROP VIEW

Grammar Description

The DROP VIEW statement indicates the delete view.

If any views named in the syntax parameter list do not exist, the statement reports an error and prompts that these non-existent views cannot be deleted and no changes are made.

The IF EXISTS clause indicates the prevention of errors due to non-existent views. When this clause is given, a NOTE is generated for each non-existent view.

Grammar Structure

> DROP VIEW [IF EXISTS]
    view_name [, view_name] ...

Example

CREATE TABLE t1(c1 INT PRIMARY KEY, c2 INT);
CREATE VIEW v1 AS SELECT * FROM t1;

mysql> DROP VIEW v1;
Query OK, 0 rows affected (0.02 sec)