删除数据库Drop Database

DROP [DATABASE | SCHEMA] [IF EXISTS] db_name [RESTRICT | CASCADE]

删除数据库并从文件系统中删除与该数据库关联的目录。Drop a database and delete the directory associated with the database from the file system. 如果该数据库不存在,则会引发异常。If the database does not exist, an exception is thrown.

IF EXISTS

如果要删除的数据库不存在,则什么都不会发生。If the database to drop does not exist, nothing happens.

RESTRICT

删除非空数据库会触发异常。Dropping a non-empty database triggers an exception. 默认情况下启用。Enabled by default.

CASCADE

删除非空数据库也会导致所有关联的表和函数被删除。Dropping a non-empty database also drops all associated tables and functions.