A transaction is a logical unit of work that contains one or more SQL statements. A transaction is considered successful if all the commands within it are executed without any errors. If an error occurs, the transaction is rolled back, meaning any changes are undone.