Monthly Archives: April 2019

MySQL transaction

Transaction feature suitable to be used in 2 conditions.

  1. If you have multiple statements to run and want to ensure all of them run successfully to conclude the task.
  2. If you want to run a delete command, and want to ensure everything is ok before commit.

How to use

run TRANSACTION or BEGIN command

then run other statement as usual

then you have option to ROLLBACK; or to COMMIT;

other reference