CBSE Class 12 Computer Science Question 29 of 47

Interface Python with SQL — Question 7

Back to all questions
7
Question

Question 7

Differentiate between commit() and rollback() statements.

Answer
commit() statementrollback() statement
The commit() method is used to permanently save the changes made during a transaction to the database.The rollback() method is used to undo or revert the changes made by a transaction.
The syntax is: connection.commit().The syntax is: connection.rollback().