CREATE DATABASE in PostgreSQL

CREATE DATABASE
Creating a database using command:

Syntax:

CREATE DATABASE name;  

Parameters:
name: It is used to specify the name of the database to be created.

Example:

CREATE DATABASE students;

Explanation:
A new database will be created with the name ‘students’.

Creating a database using UI:

  • Go to start menu.
  • Click on the pgAdmin.
  • Right-click on the PostgreSQL 9.0.
  • Connect PostgreSQL to the localhost server.
  • Right-click on the database.
  • Select a new database.
  • Type the database name in the pop-up generated.
  • Click on the “OK” button.

A new database is thus created.

 

Creating a database using the Query tool:

  • Go to start menu.
  • Click on the pgAdmin.
  • Left-click on the database.
  • Select the tools on the topmost line.
  • Left-click on the tool to get the Query tool.
  • Click on the query tool.
  • Put the “CREATE DATABASE” query here.
  • For example; CREATE DATABASE students;
  • Click on the “Play” button.

The query will thus be executed.

Please Share