Suggest an editImprove this articleRefine the answer for “Why are transactions important for data integrity?”. Your changes go to moderation before they’re published.Approval requiredContentWhat you’re changing🇺🇸EN🇺🇦UAPreviewTitle (EN)Short answer (EN)Transactions matter for data integrity because they **prevent the database from ending up in an incomplete or contradictory state** if something goes wrong mid-operation - for example, during a money transfer between accounts: if the second operation fails, without a transaction the first account would decrease while the second never increases, and the money would just "disappear". **Key point:** transactions prevent data loss or duplication, protect against partially completed operations, and guarantee the database always reflects the system's **real, consistent state**.Shown above the full answer for quick recall.Answer (EN)ImageTransactions matter for data integrity because they **prevent the database from ending up in an incomplete or contradictory state**, if something goes wrong while operations are running. ### Example Say a money transfer between accounts is underway: ```sql BEGIN; UPDATE accounts SET balance = balance - 500 WHERE id = 1; UPDATE accounts SET balance = balance + 500 WHERE id = 2; COMMIT; ``` If the second operation fails (e.g. due to a network error), without a transaction, the first account decreases while the second never increases, so the money "disappears". With a transaction, everything rolls back, and the data stays consistent. **Why this matters:** - it prevents data loss or duplication; - it protects against partially completed operations; - it guarantees the database always reflects the system's **real, consistent state**. **Summary:** Transactions are a mechanism that **preserves the logical integrity of data**, guaranteeing that any change to the database is either **fully applied** or **fully undone**.For the reviewerNote to the moderator (optional)Visible only to the moderator. Helps review go faster.