DROP VIEW
Descriptionβ
Delete a view in the current or specified database.
Syntaxβ
DROP VIEW [ IF EXISTS ] <name>
Required Parametersβ
The name of the view to be deleted.
Optional Parametersβ
[ IF EXISTS ]
If this parameter is specified, no error will be thrown when the view does not exist, and the deletion operation will be skipped directly.
Access Control Requirementsβ
The user executing this SQL command must have at least the following privileges:
Privilege | Object | Notes |
---|---|---|
DROP_PRIV | Table |
Usage Notesβ
Deleted views cannot be restored and must be recreated.
Examplesβ
CREATE VIEW vtest AS SELECT 1, 'test';
DROP VIEW IF EXISTS vtest;