To start a transaction in MySQL, you can use either START TRANSACTION, BEGIN, or BEGIN WORK statement.
Example:
START TRANSACTION;
-- or
BEGIN;
-- or
BEGIN WORK;
Committing a transaction in MySQL saves all changes made within the transaction to the database. Use the COMMIT statement to commit a transaction.
Example:
COMMIT;
If an error occurs or if you need to discard the changes made within a transaction, you can roll back the transaction using the ROLLBACK statement.
Example:
ROLLBACK;

