A transaction is one or more SQL statements that must be completed as a whole. Transactions provide a way of grouping multiple operations into a single all-or-nothing action. There are three types of transactions: autocommit transactions, explicit transactions defined using transaction control statements, and implicit transactions enabled by setting the implicit transactions session setting. Transactions ensure data integrity and consistency using the ACID properties - atomicity, consistency, isolation, and durability.