DROP VIEW

Description

DROP VIEW removes one or more views.

If any views named in the argument list do not exist, the statement fails with an error indicating by name which nonexisting views it was unable to drop, and no changes are made.

The IF EXISTS clause prevents an error from occurring for views that don’t exist. When this clause is given, a NOTE is generated for each nonexistent view.

Syntax

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

Examples

  1. CREATE TABLE t1(c1 INT PRIMARY KEY, c2 INT);
  2. CREATE VIEW v1 AS SELECT * FROM t1;
  3. mysql> DROP VIEW v1;
  4. Query OK, 0 rows affected (0.02 sec)