MCQ IN COMPUTER SCIENCE & ENGINEERING

COMPUTER SCIENCE AND ENGINEERING

SQL

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
Which of the following are valid Cursor methods used to execute SQL statments and retrieve query results? Select all that apply.
A
Cursor.fetchall()
B
Cursor.execute()
C
Cursor.run()
D
Cursor.fetchmany()
E
Cursor.fetchone()
Explanation: 

Detailed explanation-1: -(B) cursor. execute(query, rows)-It executes the given SQL statement.

Detailed explanation-2: -execute() Method. This method executes the given database operation (query or command). The parameters found in the tuple or dictionary params are bound to the variables in the operation.

Detailed explanation-3: -fetchall() fetches all the rows of a query result. It returns all the rows as a list of tuples.

Detailed explanation-4: -fetchall() Method. The method fetches all (or all remaining) rows of a query result set and returns a list of tuples. If no more rows are available, it returns an empty list. You must fetch all rows for the current query before executing new statements using the same connection.

There is 1 question to complete.