Create Database by Using Statement
Create Database by Using Statement
1.
Create database......................................................................................................... 1
Create database by using statement....................................................................................1
Create database by graphic tool........................................................................................ 1
Create database by using a template...................................................................................3
2. Rename a database........................................................................................................ 6
Rename database by using statement..................................................................................6
Rename database by graphic tool...................................................................................... 6
3. Drop a database............................................................................................................ 7
Drop database by using statement...................................................................................... 7
Drop database by using graphic tool...................................................................................7
1. Create database
We can create a database by one of following way:
- In the New Database dialog, enter Fsoft_Training in the Database name textbox.
We can change location for mdf and ldf file in database files
Each database has at least one mdf file
ldf file is a transaction log file. In real world, we should store mdf and ldf in the separate hard disk drive.
Click OK button to create the database
- Just enter database name in the script and run Execute as below
2. Rename a database
Rename database by using statement
- Use the below statement in order to rename the database.
USE master;
GO
ALTER DATABASE Fsoft_Training
Modify Name = Fsoft_Training2 ;
GO
3. Drop a database
Drop database by using statement
- Copy and Paste below statement and click Execute
USE master
GO
DROP DATABASE Fsoft_Training
GO
- In the Delete Object dialog, make sure Close existing connections is checked and then click OK