- SQL Basics
- SQL Home
- SQL Syntax
- SQL RDBMS
- SQL Databases
- SQL Data Types
- SQL Operators
- SQL Expressions
- SQL Database
- SQL Create Database
- SQL Select Database
- SQL Drop Database
- SQL Table
- SQL Create Table
- SQL Drop Table
- SQL Keywords
- SQL Insert Into
- SQL Select
- SQL Where
- SQL And & Or
- SQL Update
- SQL Delete
- SQL Like
- SQL Select Top
- SQL Group By
- SQL Order By
- SQL Distinct
- SQL In
- SQL Between
- SQL Joins
- SQL Joins
- SQL Inner Join
- SQL Left Join
- SQL Right Join
- SQL Full Join
- SQL Constraints
- SQL Constraints
- SQL Unique
- SQL Not Null
- SQL Primary Key
- SQL Foreign Key
- SQL Check
- SQL Default
- SQL Create Index
- SQL Advance
- SQL Aliases
- SQL Union
- SQL Auto Increment
- SQL Views
- SQL Dates
- SQL Transactions
- SQL Injection
- SQL Test
- SQL Online Test
- Give Online Test
- All Test List
SQL Transactions
In SQL, a Transaction is a unit of work that is performed against a database
Transactions are units or sequences of work accomplished in a logical order, whether in a manual fashion by a user or automatically by some sort of a database program
A Transaction is the propagation of one or more changes to the database. For example, if you are creating/updating/deleting a record from the table, then you are performing transaction on the table. It is important to control the transactions to ensure data integrity and to handle database errors
Practically, you will club many SQL queries into a group and you will execute all of them together as a part of a transaction
Properties of Transactions
Transactions have the following four standard properties, usually referred to by the acronym ACID listed below:
- Consistency - Ensures that the database properly changes states upon a successfully committed transaction
- Atomicity - Ensures that all the operations within the work unit are completed successfully, otherwise, the transaction is aborted at the point of failure, and previous operations are rolled back to their former state
- Isolation - Enables transactions to operate independently of and transparent to each other
- Durability - Ensures that the result/effect of a committed transaction persists in case of a system failure
SQL Transaction Control
There are the following SQL commands which can be used to control the transactions:
- COMMIT - To save the changes
- ROLLBACK - To rollback the changes
- SAVEPOINT - Creates points within the groups of transactions in which to ROLLBACK
- SET TRANSACTION - Places a name on a transaction
SQL Transactional control commands are only used with the DML commands UPDATE, INSERT, and DELETE only
« Previous Tutorial Next Tutorial »
Like/Share Us on Facebook 😋