SQL TCL Commands
TCL Commands in SQL
Transaction Control Language (TCL) Command are used to manage transaction in database.
TCL Commands
All TCL commands are given below;
- commit
- rollback
- savepoint
savepoint
A SAVEPOINT is a point in a transaction when you can roll the transaction back to a certain point without rolling back the entire transaction.
Syntax
savepoint savepoint_name;
commit
The COMMIT command is the transaction command used to save changes invoked by a transaction to the database. The COMMIT command saves all transactions to the database since the last COMMIT or ROLLBACK command.
Syntax
commit;
Note: Transaction control commands are only used with the DML commands INSERT, UPDATE and DELETE only. They can not be used while creating tables or dropping them because these operations are automatically committed in the database.
Properties of Transaction managements
Every transaction follows some transaction properties these are called ACID properties.
Atomicity: Atomicity of a transaction is nothing but in a transaction either all operations can be done or all operation can be undone, but some operations are done and some operation are undone should not occur.
Consistency: Consistency means, after a transaction completed with successful, the data in the data store should be a reliable data this reliable data is also called as consistent data.
Isolation: Isolation means, if two transaction are going on same data then one transaction will not disturb another transaction.
Durability: Durability means, after a transaction is completed the data in the data store will be permanent until another transaction is going to be performed on that data.