Which of the following is invalid method for fetching the records from database within Python?
(A) fetchone()
(B) fetchmany()
(C) fetchall()
(D) fetchmulti()
Answer:
There are 3 methods used for fetching the records from a database within python.
Method |
Used to |
fetchone( ) |
Returns one row from the result set |
fetchmany([size]) |
Returns the number of rows specified by the size parameter |
fetchall( ) |
Returns all the rows from the result set |
Checking the options
- (A) fetchone( ) - It is a valid method for fetching records from a database within python.
- (B) fetchmany( ) - It is a valid method for fetching records from a database within python.
- (C) fetchall( ) - It is a valid method for fetching records from a database within python.
- (D) fetchmulti( ) - It is not a valid method for fetching records from a database within python.
So, the correct answer is (D)