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 SQL database we can secure data by providing limited access permissions for users and we can use database for online transactions.

 

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

 

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

SQL Create Database Statement

By using “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 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 above statement it will create a new database called "sqltutorialexamples" in our server. We can find newly created database (“sqltutorialexamples”) in SQL Server management studio under 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 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 OK button it will create a new database “sqltutorialexamples” in sql server. To check 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 CREATE DATABASE statement or sql server management studio based on our requirements.

Topics Covered