Q. What do you mean by commit?


Answer :-

Since INSERT and UPDATE are also SQL commands, you can execute them just the way you have executed SELECT queries earlier. That is, store the query in a string as a simple query or as a parametrised query and execute it using cursor.execute() method.

BUT one important thing you must ensure with INSERT and UPDATE queries (which make changes to the database unlike SELECT) you must commit your query after executing INSERT and UPDATE queries.

For this your must run commit() method of connection in the end i.e.

<connection object>.commit()

This is done to reflect the change in the database physically.

Post a Comment

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

Previous Post Next Post