Sqlite

SQLite Transaction Control Statements

SQLite Transaction Control Statements

SQLite Transaction control statements are used to control the database transactions. Transactions are used to group a sequence of SQL statements into a single unit of work executed as a whole.

SQLite Transaction

A transaction is a sequence of one or more SQL statements that are executed as a single unit of work. A transaction ensures that the operations within it are completed entirely or not at all, preserving the ACID properties:

  • Atomicity:€“ All operations in the transaction are completed, or none are.
  • Consistency:€“ The database remains in a consistent state before and after the transaction.
  • Isolation: “ Transactions are isolated from each other until they are complete.
  • Durability:€“ Once a transaction is committed, its changes are permanent, even in the event of a crash.

 

 

SQLite Transaction Statements

Transaction Statements

The following statements are used to control transactions in SQLite:

SQLite Transaction Statement
Description
BEGIN TRANSACTION; The BEGIN TRANSACTION statement is used to start a transaction.
COMMIT; The COMMIT statement is used to save the changes to the database.
ROLLBACK; The ROLLBACK statement is used to roll back the changes made by the transaction.

 

SQLite Tutorials

SQLite tutorials on this website: