<topicid="topic1"><titleid="cr20941">DROP DATABASE</title><body><pid="sql_command_desc">Removes a database.</p><sectionid="section2"><title>Synopsis</title><codeblockid="sql_command_synopsis">DROP DATABASE [IF EXISTS] <varname>name</varname></codeblock></section><sectionid="section3"><title>Description</title><p><codeph>DROP DATABASE</codeph> drops a database. It removes the catalog entries for the database
and deletes the directory containing the data. It can only be executed by the database
owner. Also, it cannot be executed while you or anyone else are connected to the target
database. (Connect to <codeph>template1</codeph> or any other database to issue this
database. (Connect to <codeph>postgres</codeph> or any other database to issue this
command.) </p><notetype="warning"><codeph>DROP DATABASE</codeph> cannot be undone. Use it with care!</note></section><sectionid="section4"><title>Parameters</title><parml><plentry><pt>IF EXISTS</pt><pd>Do not throw an error if the database does not exist. A notice is
issued in this case. </pd></plentry><plentry><pt><varname>name</varname></pt><pd>The name of the database to remove.</pd></plentry></parml></section><sectionid="section5"><title>Notes</title><p><codeph>DROP DATABASE</codeph> cannot be executed inside a transaction
block.</p><p>This command cannot be executed while connected to the target database.