A transaction groups several SQL operations into an indivisible whole: they all succeed (COMMIT) or are all undone (ROLLBACK). It respects the ACID properties. It is used to keep the database consistent, for example for a transfer that debits one account and credits another.
Example
BEGIN;
UPDATE comptes SET solde = solde - 50 WHERE id = 1;
UPDATE comptes SET solde = solde + 50 WHERE id = 2;
COMMIT;