Difference between revisions of "Delete database"
Jump to navigation
Jump to search
(3 intermediate revisions by 2 users not shown) | |||
Line 4: | Line 4: | ||
[[DROP DATABASE]] [IF EXISTS] [[my_database_name]][[;]] | [[DROP DATABASE]] [IF EXISTS] [[my_database_name]][[;]] | ||
Do not forget the <code>;</code> at the end of the line | Do not forget the <code>;</code> at the end of the line | ||
+ | |||
+ | |||
[[DROP DATABASE]] [IF EXISTS] [[my_database_name]] (FORCE) [[;]] | [[DROP DATABASE]] [IF EXISTS] [[my_database_name]] (FORCE) [[;]] | ||
+ | Note: FORCE introduced in 2022 ([[PostgreSQL 13]]) | ||
DROP DATABASE database_name; | DROP DATABASE database_name; | ||
Line 22: | Line 25: | ||
== Related == | == Related == | ||
− | * [[DELETE]] | + | * <code>[[DELETE]]</code> |
− | * [[DROP TABLE]] | + | * <code>[[DROP TABLE]]</code> |
* <code>[[CREATE DATABASE]]</code> | * <code>[[CREATE DATABASE]]</code> | ||
* <code>[[\list]]</code> | * <code>[[\list]]</code> |
Latest revision as of 12:28, 16 December 2022
PostgreSQL[edit]
DROP DATABASE [IF EXISTS] my_database_name;
Do not forget the ;
at the end of the line
DROP DATABASE [IF EXISTS] my_database_name (FORCE) ; Note: FORCE introduced in 2022 (PostgreSQL 13)
DROP DATABASE database_name; Output: DROP DATABASE
DROP DATABASE database_name (FORCE);
ERROR: database "XXXXX" is being accessed by other users DETAIL: There are 4 other sessions using the database
Related terms:
Related[edit]
DELETE
DROP TABLE
CREATE DATABASE
\list
- PostgreSQL superuser
ALTER DATABASE
ERROR: must be owner of database
See also[edit]
Advertising: