The blog provides the how to Create SQL Server Database, how to Select Database, How to Drop created Database in the MS SQL Server.
SQL Server Create Database
MS SQL Server provides various Database operations for which a SQL Server Database creation is required as a pre-requisite. MS SQL Server Database can be divided into 2 categories
- System Database
- User Database
System Databases are provided by MS SQL Server. Below given are the list of System Databases automatically provided:
- Master
- Model
- MSDB
- Tempdb
- Resource
- Distribution
User Databases are created by Database Administrator as per the application need.
Let’s say we need to have a new Database OracleappshelpDB. Below are the possible options to do the same.
Option 1: Executed command for creating database
Syntax: Create Database <DATABASE_NAME>
SQL: Create Database OracleappshelpDB
Option 2: Using SQL Server Management Studio for creating database
- Connect to MS SQL Server.
- Right click on Database Folder
- Click -> New Database
- Enter the Database Name:OracleappshelpDB
- Owner: <Default>
SQL Server Select Database Command
Let’s say we have the table – ms_oracleapps_users which provides the listing of oracleappshelp registered users in the DATABASE – OracleappshelpDB. Below given are the possible option of selecting the data from the ms_oracleapps_users table.
Option 1: Using T-SQL script
The below command allows/ enables you to use the Database OracleappshelpDB for performing the select query.
Syntax:
Exec use <DATABASE_NAME>
SQL: Exec use OracleappshelpDB
The below SELECT Query can be performed now on the ms_oracleapps_users table
Option 2: Using SQL Server Management Studio
Syntax: Select * from <DATABASE_NAME>
SQL: Select * from ms_oracleapps_users
SQL Server Drop Database Command
Now let’s consider that we might not require the above created Database OracleappshelpDB. In that case, below given are the possible option of selecting the data from the ms_oracleapps_users table
Option 1: Using T-SQL script
The below command allows/ enables you to use the Database OracleappshelpDB for performing the select query.
Syntax: Drop Database <DATABASE_NAME>
SQL: Drop Database OracleappshelpDB
Option 2: Using SQL Server Management Studio
- Connect to MS SQL Server.
- Right click on the available Database – OracleappshelpDB
- Click -> Delete
- Click -> OK
The Database OracleappshelpDB is removed.
Comments are closed.