Introduction to Transactions and the Multi Module
Learn about transactions and their behavior.
We'll cover the following
Grouping operations
Throughout this course, we’ve been working with one database operation at a time. However, there are times when we have multiple operations that need to be treated as a group—they all need to succeed or fail together.
Example
A classic example is transferring money between two bank accounts. If we want to transfer $10 from Bob’s account and put it in Alice’s account (it’s always Bob and Alice for some reason), we have to perform two updates.
- Reducing Bob’s balance by 10.
- Increasing Alice’s balance by 10.
What would happen if the update to Bob’s balance succeeds but Alice’s balance fails? The accounts would be out of sync, and the $10 would effectively be missing.
Get hands-on with 1200+ tech skills courses.