What are transactions and their controls?

What are transactions and their controls?

Last updated:9/22/2021 2:17:12 AM

1 Answers

Ashutosh Kumar Verma
Ashutosh Kumar Verma

SQL Transaction:

A transaction is a group of operations that are treated as just one logical operation.

For example: When we withdraw money from our bank account or deposit money in the bank account.

Property of Transaction (ACID Properties) :- Transaction has four properties which we call ACID Properties.





1-Atomicity:- When the transaction is completed in a single step then the transaction is atomic.

2:-Consistency:- When the transaction takes place, the database is consistence from one state to another.

3:-Isolation:- When two or more transactions are executed simultaneously, then one transaction does not affect the other transaction.

4:-Durability:- When a transaction is completely completed then the changes that take place stay in the system permanently. That is, the transaction should be durable.

Transaction Control:

 The following commands are used to control the transaction-

1- COMMIT: This command is used to save the changes in database table.

2- ROLLBACK: It is used to roll back the changes.

3- SAVE POINT: It creates the points within the group of multiple transactions in which to rollback.

4- SET TRANSACTION: It place a name on a transaction.