It is an organized collection of structured information or data, typically stored electronically in a computer system. It is usually controlled by DBMS. In general data and DBMS along with the application which is associated with them is referred to as a database system.
DBMS- database management system is an interface between the database and the end-user.
SSMS(SQL Server Management Studio) it is only a client tool that connects the database. It is not server a just software that connects to a database server by using server IP, name and credentials.
What is data?
Data is a collection of a small info unit that is distinct. It can be used in a variety of forms such as text, numbers, media, bytes, etc. It can be stored in pieces of paper or electronic memory, etc. Word ' Data' originates from the word ' datum' which means' single piece of information.
Evolution of Databases
- File-Based
- Hierarchical Data Model
- Network database
- No-SQL database
- Cloud databases
- Self-driving databases
SQL Server database can be created, drop and altered. For doing this you can use SSMS or simple query.
1)Create a Database Using Query:
Expand|Select|Wrap|Line Numbers
- Create database database-name
.MDF file- It is a data file that contains actual data.
.LDF file:- It is a log file that means it is a transaction log file which also used to recover the database.
2)Rename Database:
Expand|Select|Wrap|Line Numbers
- alter database original_database_name modify name=new_database_name;
Another way to change the database name by using the system stored procedure.
Expand|Select|Wrap|Line Numbers
- execute sp_renamedb 'temp1','temp'
3)Drop or Delete Database:
when you drop the database behind the scene it will delete .MDF and.LDF file which is associated with this database.
Expand|Select|Wrap|Line Numbers
- Drop database database_name
The query for this to put a database in single-user mode is
Expand|Select|Wrap|Line Numbers
- Alter database database_name set SINGLE_USER with rollback immediate