SQL Create Database Statement

In SQL, database means it is a place where we can store data in one place and use that data for transactions like insert, update, delete, etc… based on requirements. In the SQL database, we can secure data by providing limited access permissions for users and we can use the database for online transactions.

 

SQL Server database is a combination of multiple tables, procedures, functions, etc. and by using the SQL database we can access data from anywhere based on the requirement of our applications.

 

In SQL, we can create databases either by using the CREATE DATABASE statement or directly from SQL Server Management Studio.

SQL Create Database Statement

By using the “CREATE DATABASE” statement, we can create a database in SQL. and the syntax of creating a database in sql server will be like as shown following.

 

CREATE DATABASE DBNAME

 Here “DBNAME” means the name of the database.

SQL Create Database Statement Example

Following is the SQL statement to create a new database “sqltutorialexamples” in sql server.

 

CREATE DATABASE sqltutorialexamples

Once we execute the above statement it will create a new database called "sqltutorialexamples" in our server. We can find a newly created database (“sqltutorialexamples”) in the SQL Server management studio under the Databases section like as shown below.

 

After creating database in sql server using query

SQL Server Management Studio Create Database

To create a new database, open SQL Server Management Studio à Right Click on Databases section à Select New Database like as shown below  

 

Create database using sql server management studio

 

Whenever we click on “New Database” it will open a New Database dialog popup like as shown below. Now we need to enter a database name, owner (it’s optional), database path to store our database file (to see database path column scroll to the right side) and click OK to create a new database like as shown below

 

give name to create new database in sql server management studio

 

Once we click on the OK button it will create a new database “sqltutorialexamples” in sql server. To check the newly created database just refresh your database section and check it that would be like as shown below.

 

After creating database in sql server using query

 

This is how we can create a database using the CREATE DATABASE statement or sql server management studio based on our requirements.