Database
Database in SQL Server is maintained with the help of types of files called as Data File and Log File.
Where
Data File - It is used for storing the data
Log file - It is used in managing the transaction
- A Database requires minimum of one data file and one log file
- Data Files are divided into two files,
- Primary Data .MDF
- Secondary Data .NDF
- Here, the primary data file, which contains the system, requires information about the database and it also contains the user data
- Secondary data only contains the user data
- The Primary data is saved with .MDf (Master data File)
- The secondary data file is saved with .NDF (Next Data File)
- The log file is saved with .LDF (Log Data File)
Types of TSQL Command
All the commands in the TSQL are classified into the following 5 categories,
- Data Definition Language (DDL)
All the commands of TSQL, that are used to create objects, alter the structure of the objects and delete the object collectively called as DDL.
- Data Manipulation Language (DML):-
All the commands of TSQL that are used to store the data into the database, modify the database and delete the data, are collectively called as DML.
- Data Query Language (DQL):-
All the commands of TSQL that are used to request data from the database are called as DQL
- Data Control Language (DCL):-
All the commands of TSQL that are used to allow the user to access the data or restrict the user from accessing the data are collectively called as DCL.
- Transaction Control Language (TCL)
All the commands of the TSQL that are used to create and manage the transaction are collectively called as DML.
- Begin Transaction
- Commit Transaction
- Rollback Transaction
- Save Transaction