Summary: in this tutorial, you will learn how to create new databases using SQL CREATE DATABASE statement.
A database is a container that contains all objects including tables, indexes, views, store procedures and data. To create a new database, you must have create database privilege in the database server.You use SQL CREATE DATABASE statement to create a new database. The syntax of the SQL CREATE DATABASE statement is as follows:
CREATE DATABASE database_name
You need to specify the database name after the CREATE DATABASE clause. There are some important points to remember to name a database:
- The database name should be as descriptive as possible. It should describe the nature of data it contains, for examples HR, Productions, Customers, and Vendors…etc.
- The database name has to be unique in a database server.
- In some platforms such as UNIX and LINUX, the name of database is case sensitive therefore you should use a consistent name, either lowercase, uppercase or camel case.
SQL CREATE DATABASE Example
We can use the SQL CREATE DATABASE statement to create northwind database, which is the sample database that we are using for our tutorials.
CREATE DATABASE northwind
If northwind database was created successfully, you will see a message returns.
For more information how to create a new database in MySQL please refer to the creating database in MySQL
In this tutorial, you have learned how to use SQL CREATE DATABASE statement to create new database.