TRANSACTION

Creates a isolated env, that we can decide if we want to commit or rollback. Which allows us to mess with the database without breaking the database. When you commit it saves the changes to the DB. When you rollback the changes are ignored.

When a transaction is killed rollback is called.

WARNING: transactions LOCKS the DB INDEFINATLY, until a rollback or a commit

To see who is blocking it please look at:

Begin

BEGIN TRANSACTION
-- any SQL stuff here

-- Rollback or commit

Rollback

Remove changes made in transaction

ROLLBACK TRANSACTION

Commit

Changes are saved to the DB

COMMIT TRANSACTION