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:

  1. A.

    CREATE

  2. B.

    INSERT

  3. C.

    SELECТ

  4. 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.

Explore the full course: Rssb Senior Computer Instructor