As previously stated, a SQL transaction is a grouping of one or more changes to a database. Let's first discuss some key terms relating to SQL transactions:
- Starting a new transaction involves using the START TRANSACTION or BEGIN keywords. This signifies the beginning of the group of SQL queries that you want to run together. Generally, you can run single queries or statements without using transactions (and if there is an error, it is still rolled back), but it's important to group related queries that update, insert, or delete data into a transaction, as you saw with the bank transfer example.
- Committing your changes involves making the changes permanent and uses the COMMIT keyword at the end of the transaction ...