Correct option is B
In Python's MySQL connectivity, the fetchall() method returns a
list of tuples by default. Each tuple represents a row from the result set. If there are no more rows to retrieve, it returns an
empty list. This behavior is common when you want to fetch all the rows from a query result at once.
Important Key Points:
1. The fetchall() method is used to fetch all rows from the result of a query in MySQL.
2. It returns a
list of tuples, where each tuple represents a row in the result set.
3. If no rows are available, it returns an
empty list.
4. This method is commonly used in conjunction with the cursor to retrieve the full result set from the database at once.
5. If there is no data in the result set, an empty list helps in avoiding errors when processing the result.
Knowledge Booster:
·
Option (a): This is incorrect because fetchall() does not return a
single list. It returns a
list of tuples, where each tuple corresponds to a row in the result set.
·
Option (c): This is also incorrect. The fetchall() method does not return a
list of dictionaries. It returns a list of tuples, not dictionaries.
·
Option (d): This option is wrong because fetchall() does not return a
single tuple. It returns a
list of tuples, each tuple representing one row in the result set.