What are transactions and their controls?

Category: SQLWhat are transactions and their controls?
Editor">Editor Staff asked 2 years ago

 What are transactions and their controls?

1 Answers
Editor">Editor Staff answered 2 years ago

A transaction can be defined as the sequence task that is performed on databases in a logical manner to gain certain results. Operations like Creating, updating, deleting records performed in the database come from transactions.
In simple words, we can say that a transaction means a group of SQL queries executed on database records.
There are 4 transaction controls such as

  • COMMIT: It is used to save all changes made through the transaction.
  • ROLLBACK: It is used to roll back the transaction. All changes made by the transaction are reverted back and the database remains as before.
  • SET TRANSACTION: Set the name of the transaction.
  • SAVEPOINT: It is used to set the point where the transaction is to be rolled back.