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 How to check if radio button is checked or not using JavaScript? #2 How to add Read More Read Less Button using JavaScript? #3 Solution to “TypeError: ‘x’ is not iterable” in Angular 9 #4 Solution to the error “Visual Studio Code can’t be opened because Apple cannot check it for malicious software” #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
How to change value of a span tag using a reference from another div using jQuery?jQueryWhat’s new in WordPress 5.5?WordPressHow to use [] (square brackets) function in Envision Basic?Envision BasicHow to show and hide an element on click in React?ReactHow to switch dark and light themes using pure CSS?CSSArray.from() Method in JavaScriptJavaScriptHow to overwrite file contents with new content in PHP?PHPHow to create a Bootstrap style accordion using CSS and JavaScript?CSSFor Each Loop in Swift for BeginnersSwiftHow to Make CSS Lists Bullets Smaller?CSSList of all Pseudo Elements in CSSCSSSolution for the error Commit failed – exit code 1 received in Desktop GithubMiscellaneous