Yogesh Chauhan's Blog

DROP DATABASE (remove a database) from Postgres

in Postgres on June 20, 2020

DROP DATABASE (remove a database) from Postgres



DROP DATABASE 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 postgres or any other database to issue this command.

DROP DATABASE cannot be undone. Use it with care!


IF EXISTS: Do not throw an error if the database does not exist. A notice is issued in this case.

name: The name of the database to remove.

DROP DATABASE cannot be executed inside a transaction block.

This command cannot be executed while connected to the target database. Thus, it might be more convenient to use the program dropdb instead, which is a wrapper around this command.

Credit: Postgresql

Most Read

#1 Solution to the error “Visual Studio Code can’t be opened because Apple cannot check it for malicious software” #2 How to add Read More Read Less Button using JavaScript? #3 How to check if radio button is checked or not using JavaScript? #4 Solution to “TypeError: ‘x’ is not iterable” in Angular 9 #5 How to uninstall Cocoapods from the Mac OS? #6 PHP Login System using PDO Part 1: Create User Registration Page

Recently Posted

#Apr 8 JSON.stringify() in JavaScript #Apr 7 Middleware in NextJS #Jan 17 4 advanced ways to search Colleague #Jan 16 Colleague UI Basics: The Search Area #Jan 16 Colleague UI Basics: The Context Area #Jan 16 Colleague UI Basics: Accessing the user interface
You might also like these
3 ways to pass a variable in url() function in SCSS (Sass)SCSSsubstring() Method in JavaScriptJavaScriptHow to Use SQL MAX() Function with Dates?SQL/MySQLHow to add today’s date in HTML input date value using JavaScript?JavaScriptRecursive WITH Queries in Postgres (Common Table Expressions)PostgresHow to animate list items using CSS and JavaScript?CSSLearn to make a responsive gallery using CSS Grid and without media queriesCSSWhat Is a Graph Database?MiscellaneousA few HTML coding standards from WordPressHTML4 advanced ways to search ColleagueColleagueLIKE and ILIKE Operators in PostgresPostgresWhat does it mean by Continuous Integration, Continuous Delivery and Continuous Deployment?Miscellaneous