Transactions are a group of database commands that can change or access data stored in a database. A transaction is considered a single unit of work and is known to maintain the integrity of data in the database.
Transaction control statements include:
COMMIT: The COMMIT command saves changes made by the transaction in the database.
Syntax:
COMMIT;
2. ROLLBACK: The ROLLBACK command is used to undo saved changes made by the transaction in the database.
Syntax:
ROLLBACK;
3. SAVEPOINT: SAVEPOINT is a point in the groups of transactions to roll back.
Syntax:
SAVEPOINT savepoint_name;
4. SET TRANSACTION: The SET TRANSACTION command is used to initiate a database 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
2-Consistency
3-Isolation
4-D-Durability
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.
Markdown for AI
A clean, structured version of this page for AI assistants and LLMs.
We use cookies to ensure you have the best browsing experience on our website. By using our site, you
acknowledge that you have read and understood our
Cookie Policy &
Privacy Policy.
Transactions are a group of database commands that can change or access data stored in a database. A transaction is considered a single unit of work and is known to maintain the integrity of data in the database.
Transaction control statements include:
Syntax:
2. ROLLBACK: The ROLLBACK command is used to undo saved changes made by the transaction in the database.
Syntax:
3. SAVEPOINT: SAVEPOINT is a point in the groups of transactions to roll back.
Syntax:
4. SET TRANSACTION: The SET TRANSACTION command is used to initiate a database transaction.
Syntax:
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
2-Consistency
3-Isolation
4-D-Durability
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.