200k views
5 votes
Which MySQLCursor object returns all the rows in a result set?

a

fetchone()

b

fecthsome()

c

fetchmany()

d

fetchall()

User Dgw
by
8.1k points

1 Answer

2 votes

Answer:

fetchall()

Step-by-step explanation:

MySQLCursor object method fetchall() method returns all the rows in the resultset.

For example:

>>> cursor.execute("SELECT * FROM Student ORDER BY rollno")

>>> rows = cursor.fetchall()

Now rows will contain a reference to the results of the query. If the size of the resultset returned by the query is 0 then rows will reference an empty set.

fetchmany() and fetchone() are , on the other hand , used to retrieve many(count specified) or one row from the result respectively.

User Crizly
by
8.5k points

No related questions found

Welcome to QAmmunity.org, where you can ask questions and receive answers from other members of our community.