Check sibling questions

Which method of cursor class is used to insert or update multiple rows using a single query?

(A) cursor.executeall(query, rows)

(B) cursor.execute(query, rows)

(C) cursor.executemultiple (query, rows)

(D) cursor.executemany(query, rows)

 

Answer:

 

Checking the options:

  • (A) cursor.executeall(query, rows) - It is not a method of cursor class.  
  • (B) cursor.execute(query, rows)  - It executes the given SQL statement.
  • (C) cursor.executemultiple (query, rows) - It is not a method of cursor class.  
  • (D) cursor.executemany(query, rows) - It executes more than one SQL statement together.

 

From the options given above, the function cursor.executemany(query, rows) is used to insert or update multiple rows using a single query

So, the correct answer is (D)

549 people joined Teachoo Black. What are you waiting for?

Davneet Singh's photo - Teacher, Engineer, Marketer

Made by

Davneet Singh

Davneet Singh is a graduate from Indian Institute of Technology, Kanpur. He has been teaching from the past 12 years. He provides courses for Maths and Science at Teachoo.