trainingtrains Logo

91-9990449935

 0120-4256464

PostgreSQL Create Database

In PostgreSQL, you can create a database by using CREATE DATABASE command.

Syntax:

Here, database_name specifies the name of the database which you want to create.


PostgreSQL Create Database using UI

  • After installing PostgreSQL in your system, go to start menu and click on the pgAdmin. You will get a page like this:  postgresql create database
  • Right click on the PostgreSQL 9.0 and connect PostgreSQL to the local host server.
  • Right click on the database, go to the new database, a pop up box will appear then type the database name you want to create.  postgresql create database
  • Click "OK".

The new database is created. See this:

postgresql  create database

PostgreSQL Create Database using Query tool

  1. Follow the 1st and 2nd steps of the above.
  2. Left click on the database.
  3. Go to the tools on the top most line.
  4. Left click on the tool and you will get Query tool. Click on the query tool and put your "CREATE DATABASE" query here.
  5. Click on the "Play" button to execute your query.

Note: You can ignore 3rd and 4th steps and Press Ctrl+E for the same result.

Execute the following query:

create database4

Database "trainingtrains" is successfully created, you can see it.

Output:

postgresql create database5