An Apex transaction represents a set of operations that are executed as a single unit. These operations include DML operations that are responsible for querying records. All the DML operations in a transaction either get completed successfully or get rolled back completely if an error occurs even in saving a single record.