Q. Differentiate between commit () and rollback () statements.


Answer =


Commit():-

Once a program has completed executing the query with your changes and you want to commit the changes to the database, then you need to call commit() method on MySQL connection object as follows.


connection.commit()


Rollback() :-

When one of the transactions fails to execute and you want to revert or undo all your changes, then you need to call a rollback method of MySQL connection object as follows:


connection.rollback()

Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post