Suggest an editImprove this articleRefine the answer for “Why do we need transactions?”. Your changes go to moderation before they’re published.Approval requiredContentWhat you’re changing🇺🇸EN🇺🇦UAPreviewTitle (EN)Short answer (EN)Transactions exist to **guarantee data integrity and reliability**, especially when **several related operations** run together: without transactions, part of the changes might get saved while another part doesn't, leaving the data in an **inconsistent state**. **Key point:** transactions provide safety for changes (if one operation in a series fails, the earlier ones roll back via `ROLLBACK`), data integrity, isolation between concurrent users, and error control.Shown above the full answer for quick recall.Answer (EN)ImageTransactions exist to **guarantee data integrity and reliability**, especially when **several related operations** run together. Without transactions, part of the changes might get saved while another part doesn't, leaving the data in an **inconsistent state**. ### What transactions are for 1. **Safety for changes.** If one operation in a series fails, every earlier one rolls back (`ROLLBACK`). 2. **Data integrity.** They prevent "half-done" actions (e.g. money leaving one account but never arriving at another). 3. **Isolation.** Concurrent users don't interfere with each other, and each one only sees completed changes. 4. **Error control.** A failure can be caught and the data restored to its pre-change state. **Example:** ```sql BEGIN; UPDATE accounts SET balance = balance - 500 WHERE id = 1; UPDATE accounts SET balance = balance + 500 WHERE id = 2; COMMIT; ``` If one row fails to update, the transaction gets cancelled, and the balance stays as it was. **Summary:** Transactions exist so the database **always stays in a correct state**, even when an error, failure, or several concurrent users are involved.For the reviewerNote to the moderator (optional)Visible only to the moderator. Helps review go faster.