Database transaction
A database transaction groups multiple operations so they either all succeed together or all fail together, leaving the database in a consistent state either way.
Prerequisite: Foreign key
What matters
Without this guarantee, a failure partway through a multi-step operation, like transferring money between two accounts, could leave data in an inconsistent, incorrect state.
Example
Transferring funds between two accounts as one transaction ensures that if the deposit step fails, the earlier withdrawal step is also undone rather than left applied.
Common misconception
A transaction failing partway through does not leave some of its steps applied and others not; the whole group is rolled back together as one unit.
Recall question
What guarantee does grouping operations into a transaction provide if one step fails?