YogeshChauhan.com
DROP DATABASE (remove a database) from Postgres
June 20, 2020

DROP DATABASE (remove a database) from Postgres

Syntax


DROP DATABASE [ IF EXISTS ] name

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!

Parameters

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

dreamhost

Leave a Reply

Most Read

#1 How to check if radio button is checked or not using JavaScript? #2 How to set opacity or transparency using CSS? #3 Pagination in CSS with multiple examples #4 How to make HTML form interactive and using CSS? #5 Solution to “TypeError: ‘x’ is not iterable” in Angular 9 #6 How to uninstall Cocoapods from the Mac OS?

Recently Posted

Mar 4 How to use data-* Attributes in HTML? Mar 4 The substr() method in JavaScript and how it’s different from substring() Mar 4 A complete guide to add responsive YouTube videos using HTML and CSS Mar 3 How to embed YouTube or other video links in WordPress? Mar 3 How to change the Login Logo in WordPress? Mar 3 substring() Method in JavaScript

You might also like these

The SQL UNION OperatorSQL/MySQL5 Key Principles Of Good Website UsabilityUI/UXUPDATE and DELETE Statements in PostgresPostgresHow to verify your domain in Google Console with a TXT record?MiscAccessing and Setting features of JavaScript ObjectsJavaScriptWhat is the difference between Loosely Typed Language and Strongly Typed Language?MiscHow to make a UILabel clickable in Swift 5?SwiftHow to get query string values in JavaScript? (URL Manipulation using URLSearchParams)JavaScriptSQL GROUP BY StatementSQL/MySQLIntroduction to Angular modules Part 3: NgModules vs JavaScript modules and Angular librariesAngularHow to Use SQL MAX() Function with Dates?SQL/MySQLHow to make WordPress main stylesheet (style.css)?WordPress