(1) transaction is the unit of concurrency control and a sequence of user-defined operations. These operations are either done or not done. They are an inseparable unit of work. Through transactions, SQL Server can bind a set of logical operations to ensure data integrity on the server.
(2): transactions generally start with begin transaction and end with commit or rollback.
Commit indicates commit, that is, all operations to commit a transaction. Specifically, all the updates to the database in the transaction are written back to the physical database on the disk, and the transaction ends normally.
Rollback indicates rollback, that is, a fault occurs during the transaction operation, and the transaction cannot continue. The system revokes all the completed operations on the database in the transaction, roll back to the starting state of the transaction.
(3) three modes of transaction operation:
A: automatically submit transactions.
Each separate statement is a transaction. Each statement implies a commit.
B: explicit transactions
Start explicitly with begin transaction and end explicitly with commit or rollback.
C: Implicit transactions
When the previous transaction was completed, the new transaction was started implicitly, but each transaction still ended explicitly with commit or rollback.
(4): ACID properties of transactions)
A: atomicity)
A transaction is the logical unit of work of a database. All operations in a transaction are either performed in full or not.
B: Consistency)
The result of transaction execution must be that the database changes from one consistent state to another consistent state. Consistency is closely related to atomicity.
C: Isolation)
The execution of a transaction cannot be disturbed by other transactions.
D: Durability)
Once a transaction is committed, its changes to the data in the database should be permanent.
Note: transactions are the basic unit for recovery and concurrency control.