Which method of cursor class is used to get the number of rows affected after any of the insert/ update/delete database operation executed from Python?

(A) cursor.rowcount

(B) cursor.getaffectedcount

(C) cursor.rowscount

(D) cursor.rcount

 

Answer:

 

Checking the options

  • (A) cursor.rowcount - It returns the number of rows affected by DML statements.  
  • (B) cursor.getaffectedcount  - It is not a method of cursor class.
  • (C) cursor.rowscount - It is not a method of cursor class.
  • (D) cursor.rcount - It is not a method of cursor class.

 

From the options given above, the function cursor.rowcount is used to get the  number of rows affected after any of the insert/update/delete database operations executed from Python.

So, the correct answer is (A)

Go Ad-free
Davneet Singh's photo - Co-founder, Teachoo

Made by

Davneet Singh

Davneet Singh has done his B.Tech from Indian Institute of Technology, Kanpur. He has been teaching from the past 14 years. He provides courses for Maths, Science and Computer Science at Teachoo