DROP VIEW [IF EXISTS]view_name
[,view_name
] ... [RESTRICT | CASCADE]
DROP VIEW
removes one or more views. DROP VIEW
删除一个或多个视图。You must have the 您必须具有每个视图的DROP
privilege for each view.DROP
权限。
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.如果参数列表中命名的任何视图不存在,则语句将失败,并出现一个错误,通过名称指示无法删除的不存在视图,并且不会进行任何更改。
In MySQL 5.7 and earlier, 在MySQL 5.7及更早版本中,如果参数列表中的任何视图不存在,DROP VIEW
returns an error if any views named in the argument list do not exist, but also drops all views in the list that do exist. DROP VIEW
会返回一个错误,但也会删除列表中确实存在的所有视图。Due to the change in behavior in MySQL 8.0, a partially completed 由于MySQL 8.0中的行为改变,在MySQL 5.7复制源服务器上复制时,部分完成的DROP VIEW
operation on a MySQL 5.7 replication source server fails when replicated on a MySQL 8.0 replica. DROP VIEW
操作会失败。To avoid this failure scenario, use 若要避免此故障场景,请在IF EXISTS
syntax in DROP VIEW
statements to prevent an error from occurring for views that do not exist. DROP VIEW
语句中使用IF EXISTS
语法,以防止不存在的视图发生错误。For more information, see Section 13.1.1, “Atomic Data Definition Statement Support”.有关更多信息,请参阅第13.1.1节,“原子数据定义语句支持”。
The IF EXISTS
clause prevents an error from occurring for views that don't exist. IF EXISTS
子句防止不存在的视图发生错误。When this clause is given, a 给出此子句后,将为每个不存在的视图生成NOTE
is generated for each nonexistent view. NOTE
。See Section 13.7.7.42, “SHOW WARNINGS Statement”.请参阅第13.7.7.42节,“显示警告声明”。
RESTRICT
and CASCADE
, if given, are parsed and ignored.RESTRICT
和CASCADE
(如果给定)将被解析和忽略。