commit() is required to be used after the execution of certain queries in…
2023
commit() is required to be used after the execution of certain queries in Python-MySQL connectivity applications. Identify one such MySQL command out of the following options:
- A.
CREATE
- B.
INSERT
- C.
SELECТ
- D.
DROP
Attempted by 1161 students.
Show answer & explanation
Correct answer: B
Key point: commit() is required after DML statements that modify data (for example INSERT, UPDATE, DELETE). INSERT adds new records. After executing an INSERT, call connection.commit() to persist the change unless autocommit is enabled.
A video solution is available for this question — log in and enroll to watch it.