How to Create database in PostgreSQL PSQL and PgAdmin 4

By    

How to create database in PgAdmin 4


how to create database in pgadmin 4

Open connected server, then right click "databases" to create new database. Select "Create" then click on the option "Database".


how to create database in pgadmin 4

Create Database wizard will be opened to create database. 

how to create database in pgadmin 4

Give database name and other details to create database using PgAdmin 4. Here we will give the database name as "NoviceTechie", then click "Save"

how to create database in pgadmin 4


Database will be created under the Databases.

Create database in PostgreSQL using PSQL

In Postgres CREATE DATABASE command creates new PostgreSQL database. The syntax to create database in PostgreSQL is
CREATE DATABASE database_name
WITH
   [OWNER =  role_name]
   [TEMPLATE = template]
   [ENCODING = encoding]
   [LC_COLLATE = collate]
   [LC_CTYPE = ctype]
   [TABLESPACE = tablespace_name]
   [ALLOW_CONNECTIONS = true | false]
   [CONNECTION LIMIT = max_concurrent_connection]
   [IS_TEMPLATE = true | false ]

PSQL command to create database in PostgreSQL server is

CREATE DATABASE database_name;

Using above postgres createdb command will create a new database in post gre sql server with default parameter. To execute the CREATE DATABASE statement you need to have a superuser role or a special CREATEDB privilege.

Psql list databases command is

A Single Postgres server process has the capability to handle multiple databases simultaneously. Each database is stored in distinct sets of files within its dedicated directory within the server's data directory. To observe all the defined databases on the server, you can utilize the \list meta-command or its shortcut \l.
\l

This command used to list all databases created in Postgresql server.

0 comments