I'm using RDS Aurora (MySQL 5.6)
By default Auto Commit flag is enabled. I have a transaction as follows
BEGIN;
INSERT INTO .....;// STATEMENT 1
INSERT INTO ......;//STATEMENT 2
COMMIT;
I'm expecting both the Inserts to be commited only when COMMIT is executed. But Statement 1 is Commiting as soon as it got executed.
So I wanted to know What does BEGIN do here ??
I was assuming that BEGIN does the task of disabling Auto Commit , Can someone also explain the difference between BEGIN and START TRANSACTION as well.
BEGIN
starts code block. It is not relative to transactions. The only purpose of a BEGIN-END block (in addition to code structuring) is to create an existence/visibility area for the structures defined in it (variables, handlers, etc.).