DROP DATABASE

Delete the database.

Summary

DROP DATABASE [IF EXISTS] name

describe

DROP DATABASE deletes the database. It deletes the directory entry of the database and deletes the directory containing the data. It can only be executed by the database owner. Also, the command cannot be executed when you or anyone else connect to the target database.

Parameters

IF EXISTS

  • If the database does not exist, please do not report an error. In this case, a notification will be issued.

name

  • The name of the database to be deleted.

Note

DROP DATABASE cannot be executed inside a transaction block.

Example

Delete the database named testdb:

DROP DATABASE testdb;

compatibility

There is no DROP DATABASE statement in the SQL standard.

See also

CREATE DATABASE , ALTER DATABASE