SQL
Data Structure
DBMS
PL/SQL
MY SQL
Mongo DB
PostgreSQL
SQL Server
Oracle
Cassandra
SQL Create Database
In SQL, the 'Create Database' statement is a first step for storing the structured data in the database.
The database developers and the users use this statement in SQL for creating the new database in the database systems. It creates the database with the name which has been specified in the Create Database statement.
Syntax of Create Database statement in SQL
In this syntax, Database_Name specifies the name of the database which we want to create in the system. We have to type the database name in query just after the 'Create Database' keyword.
Following are the most important points which are required to learn while creating a database:
- The database we want to create should be a simple and unique name, which can be easily identified.
- Database name should be no more than 128 characters.
Syntax of Create Database statement in MySQL
The same command is used in MySQL to create the new database for storing the structured data.
- CREATE DATABASE Database_Name;
Syntax of Create Database in Oracle
There is no need to create the database in Oracle systems. In the Oracle database, we can directly create the database tables.
Examples of Create Database statement in SQL
In this article, we took the following two examples which will help how to run and perform the Create Database query in SQL:
Example :
This example creates the Student database. To create the Student database, you have to type the following command in Structured Query Language:
CREATE DATABASE Student ;
When this query is executed successfully, then it will show the following output:
Database created successfully
You can also verify that your database is created in SQL or not by using the following query:
SHOW DATABASE ;
SQL does not allow developers to create the database with the existing database name. Suppose if you want to create another Student database in the same database system, then the Create Database statement will show the following error in the output:
Can't create database 'Student'; database exists
So, firstly you have to delete the existing database by using the Drop Statement. You can also replace the existing database with the help of Replace keyword.
If you want to replace the existing Student database, then you have to type the following SQL query: