Suggest an editImprove this articleRefine the answer for “What does the ROLLBACK command do?”. Your changes go to moderation before they’re published.Approval requiredContentWhat you’re changing🇺🇸EN🇺🇦UAPreviewTitle (EN)Short answer (EN)The `ROLLBACK` command undoes every change made within the current transaction and **returns the database to the state it was in before the transaction started**; it's used when an error occurs or when changes need to be cancelled before committing (`COMMIT`). **Key point:** after `ROLLBACK`, both changes are undone - the database looks as though the transaction **never ran at all**.Shown above the full answer for quick recall.Answer (EN)ImageThe `ROLLBACK` command undoes every change made within the current transaction and **returns the database to the state it was in before the transaction started**. It's used when an error occurs or when changes need to be cancelled before committing (`COMMIT`). ### Example ```sql START TRANSACTION; UPDATE users SET balance = balance - 100 WHERE id = 1; UPDATE users SET balance = balance + 100 WHERE id = 2; ROLLBACK; ``` After `ROLLBACK`, both changes are undone - the database looks as though the transaction **never ran at all**.For the reviewerNote to the moderator (optional)Visible only to the moderator. Helps review go faster.