How to create and drop database in PostgreSQL DB

 How to create and drop database in PostgreSQL DB



postgres=# create database employees owner postgres;
CREATE DATABASE

postgres=# select datname,oid from pg_database;
  datname  |  oid
-----------+-------
 postgres  |     5
 amit      | 24578
 template1 |     1
 template0 |     4
 employees | 24586
(5 rows)


postgres=# drop database employees;
DROP DATABASE


Note - Create and drop database - first create database and folder, once we execute drop database command, Drop database command will drop database along with folder created for the database.

Comments