EN
PostgreSQL - Drop database
0 points
In this article, we would like to show you how to DROP
database in PostgreSQL.
Quick solution:
xxxxxxxxxx
1
DROP DATABASE "database_name";
In this example, we will drop database named diraskDB
.
Query:
xxxxxxxxxx
1
DROP DATABASE "diraskDB";
You can optionally add IF EXISTS
statement, so if the database doesn't exist you won't get an error.
Query:
xxxxxxxxxx
1
DROP DATABASE IF EXISTS "diraskDB";
If you try to drop database that doesn't exist with DROP DATABASE
query you will get an error:

If you try to DROP DATABASE IF EXISTS
you will get a warning instead:
