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 remove trailing characters from a string using JavaScript?JavaScriptHow to check if the page is the home page in WordPress?WordPressHow to center an image horizontally and vertically?CSSLearn to create your skill bar using CSSCSSHow to create a sidebar using pure CSS?CSSadd_filter function in WordPressWordPress5 Steps to Create a Line using Canvas Tag in HTML5HTMLHow to switch dark and light themes using pure CSS?CSSHow to create bouncing balls using HTML canvas and JavaScript?HTMLHow to get the full URL of current page in PHP?PHPHow to detect the Blog Page in WordPress?WordPressWhere is the PHP log file located on Mac OS?PHP