Creating database in ms sqlserver

For creating database following command is used 
        create database name_of_database
For example we want to create database with name myshop :

 create database myshop;

Now for using  database myshop run following command
 

 use myshop

To view different related object of myshop database use command 

exec sp_help

In above case we created database without checking database name wheather already exists or not. Before creating database we should check  database name

if exists (Select * from INFORMATION_SCHEMA.SCHEMATA where CATALOG_NAME='myshop')
 begin
  raiserror('Database myshop already  exists....',0,1)
 end
else
 begin
  create database myshop
 end

If you want to delete existing database and want to create new one with same name

if exists (Select * from INFORMATION_SCHEMA.SCHEMATA where CATALOG_NAME='myshop')
 begin
  raiserror('Dropping myshop and creating new one....',0,1)
  Drop myshop
  Create database myshop
 end