Hi Palak,
MySQL, like any other RDBMS executes one ANSI SQL statement at a time.
In Transaction Control, a set of MySQL statement must be executed together such that all SQL statements execute successfully.
Even if one SQL statement in the block of SQL statement being executed fails, then all the SQL statements within the SQL statement block must be Rolled Back together and the database tables returned to their state prior the SQL transaction being executed.
To force MySQL to execute a block of SQL statements as a single transaction, simply enclose the block of SQL statement with a:
Begin Transaction
SQL statement 1
SQL statement 2
SQL statement 3
End Transaction
When the MySQL engine encounters the Begin Transaction and End Transaction, keywords, the MySQL DB engine recognizes that the block of SQL statements contained within have to be treated as one homogeneous block.
Regards,
Prerna