YogeshChauhan . com

DROP DATABASE (remove a database) from Postgres

in Postgres on 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

amazon

Most Read

#1 How to check if radio button is checked or not using JavaScript? #2 Solution to “TypeError: ‘x’ is not iterable” in Angular 9 #3 How to add Read More Read Less Button using JavaScript? #4 How to uninstall Cocoapods from the Mac OS? #5 How to Use SQL MAX() Function with Dates? #6 PHP Login System using PDO Part 1: Create User Registration Page

Recently Posted

Jun 16 What are Stored Procedures for SQL Server? Jun 16 What are Class Constants in PHP? Jun 15 A short basic guide on states in React Jun 15 How to define constants in PHP? Jun 15 How to define visibility for a property in PHP? Jun 15 How to use @if and @else in SCSS?

You might also like these

How to create a Bootstrap style accordion using CSS and JavaScript?CSSMicroservices vs Monolithic ArchitectureMiscAll possible ways you can Insert Data in PostgresPostgresOpen Source Security Tools for Defense SecurityMiscWindow setTimeout() Method in JavaScriptJavaScriptCONCAT and CONCAT_WS Functions in PostgresPostgresWhat are keys in React?ReactHow to use data-* Attributes in HTML?HTMLHow to show confirmation alerts with OK and cancel buttons using Swift 5?SwiftSorting Arrays in JavaScriptJavaScriptCan We Use For Loop to Loop Through Associative Arrays in PHP?PHPCreate a currency (dollar) to coins convertor in ReactReact