PostgreSQL How to drop a database in PostgreSQL

In order to drop a database in PostgreSQL, you have to use the DROP DATABASE statement followed by the name of the database you want to drop. For example, if you want to drop a database named my_database, you will have to run the following SQL statement:
DROP DATABASE my_database;

If the database you want to drop does not exist, PostgreSQL will throw an error. If you don't want an error, make sure the database is dropped only if it exists:
DROP DATABASE IF EXISTS my_database; 

Looking for a backup solution? Try Weap.io

Simple & flexible backup solution to keep your servers, websites & databases safe.

Start free trial
App screenshot