SQL

SQL – CREATE Database

In this article we will learn, SQL – CREATE Database

SQL – CREATE Database

A SQL Server database we can be created by two way
1. Graphically using SQL Server Management Studio (SSMS) or
2. Using a Query

To create the database graphically. Always the database name should be unique within the RDBMS.

SQL – CREATE Database

1. Right Click on Databases folder in the Object explorer
2. Select New Database
3. In the New Database dialog box, enter the Database name and click OK. You can see in screenshot.

2. To Create the database using a query.

The Create database statement is used to create a new SQL database.

Create database tblEmp

Notes: tblEmp is a database name. Make sure you have admin privilege before creating any database. Once a database is created, you can check it in the list of databases with the following SQL command: SHOW DATABASE;

When, you create a database graphically using the designer or, using a query, theseĀ  2 files automatically generated.
.MDF file – Data File (Contains actual data)
.LDF file – Transaction Log file (Used to recover the database)

 

Leave a Reply

Your email address will not be published.