Use the DROP DATABASE statement to delete a database.
Syntax
DROP DATABASE [IF EXISTS] database_name;Parameters
| Parameter | Description |
|---|---|
IF EXISTS | Suppresses the error that occurs when you try to drop a database that does not exist. A warning is generated instead. |
database_name | The name of the database to drop. |
Examples
Drop a database named customer:
DROP DATABASE customer;Output:
Query OK, 0 rows affected (0.03 sec)Use IF EXISTS to suppress the error when dropping a database that does not exist. A warning is generated instead:
DROP DATABASE IF EXISTS customer;Output:
Query OK, 0 rows affected, 1 warning (0.00 sec)该文章对您有帮助吗?