PostgreSQL CREATE Database
In PostgreSQL Create DataBase statement is used to create a new database in PostgreSQL.PostgreSQL provides two ways of creating a new database −
1. Using CREATE DATABASE, an SQL command:-CREATE DATABASE command will create a new database in shell prompt, but user should have appropriate privilege to create a database.
2. Using createdb a command-line executable:-createdb is a wrapper around the SQL command CREATE DATABASE.
Create DataBase Syntax :
The syntax of the Create DataBase is −
\\Using CREATE DATABASE CREATE DATABASE databasename; ----------------------------- \\Using createdb Command createdb [option...] [dbname [description]]
Create DataBase Example :
The Example of the Create DataBase is −
postgres-# CREATE DATABASE lfcdb; postgres-#
After a database is created, you can view it in the list of databases with the following postgreSQL command: SHOW DATABASES;
SHOW DATABASES; ---------------- testDB letsfindcourse LfcDB test myDB
Visit :
Discussion