A database transaction is a collection of SQL queries that form a logical task. For the transaction to complete successfully, all SQL queries must run successfully. Transactions are implemented using SQL keywords like transaction, commit, and rollback to ensure the database remains consistent whether the transaction succeeds or fails. Transactions have four key properties (ACID) to keep the database secure and data accurate.