Transactions
Commit and rollback.
What is a Transaction?
A transaction groups several SQL operations into a single all-or-nothing unit.
Either every statement succeeds and the changes are made permanent (commit), or something fails and they are all undone (rollback). This keeps the database consistent.
ACID in One Minute
Transactions provide the ACID guarantees:
- Atomicity — all or nothing.
- Consistency — moves the DB from one valid state to another.
- Isolation — concurrent transactions do not corrupt each other.
- Durability — once committed, changes survive a crash.