Which method of cursor class is used to fetch limited rows from the table?
(A) cursor.fetchsize(SIZE)
(B) cursor.fetchmany(SIZE)
(C) cursor.fetchall(SIZE)
(D) cursor.fetchonly(SIZE)
Answer:
Checking the options
- (A) cursor.fetchsize(SIZE) - It is not a method of cursor class.
- (B) cursor.fetchmany(SIZE) - It returns the number of rows specified by the size argument.
- (C) cursor.fetchall(SIZE) - It returns all the rows of a query result.
- (D) cursor.fetchonly(SIZE) - It is not a method of cursor class.
From the options given above, the function cursor.fetchmany(SIZE) is used to fetch limited rows from the table.
So, the correct answer is (B)