DROP DATABASE
Drops a database.
Syntax
DROP DATABASE [IF EXISTS] <name> [ WITH FORCE ]
Description
DROP DATABASE deletes all catalog entries of the database as well as the directory that contains the data. It cannot be undone. Use with caution.
Parameters
-
IF EXISTSIf you include
IF EXISTSin your statement, no error will be reported when the specified database does not exist. A notice will be issued instead. -
<name>The name of the database.
-
WITH FORCESpecifies to forcibly drop the database, no matter whether anyone is connected to it. Without specifying this option, the database will fail to be dropped if anyone is connected to it.
Usage notes
DROP DATABASE cannot be run inside a transaction block.
Examples
Drop database testonly:
DROP DATABASE testonly;
SQL standard compatibility
Standard SQL does not support DROP DATABASE.