Transaction
A transaction is a group of SQL statements executed as a single all-or-nothing unit. A COMMIT makes every change permanent; a ROLLBACK undoes them all.
Transactions guarantee the database moves from one consistent state to another. The classic example is a bank transfer: debiting one account and crediting another must both succeed or both be undone, so money is never lost mid-transfer.
Transactions obey the ACID properties, and their isolation level controls how much concurrent transactions can see of each other's uncommitted work.
Example
BEGIN;
UPDATE accounts SET balance = balance - 500 WHERE id = 1;
UPDATE accounts SET balance = balance + 500 WHERE id = 2;
COMMIT;