Mandatory arguments required to connect any database from Python
Which method of cursor class is used to fetch limited rows from the table?
1 Crore+ students have signed up on EduRev. Have you? Download the App |
Which method of cursor class is used to insert or update multiple rows using a single query?
Which method of cursor class is used to get the number of rows affected after any of the insert/ update/delete database operation executed from Python?
_______ is the set of records that are retrieved after execution of SQL query over an established database connection.
Which of the following is invalid method for fetching the records from database within Python?
Which of the following method reflects the changes made in database permanently?
The special control structure that facilitates row by row processing of records in resultset.
Consider the following code:
importMySQLdb
d b = M y S Q L d b. c o n n e c t (‘ l o c a l h o s t ’ ,
‘LIBMAN’,‘Admin@pwd’,‘library’)
cursor=db.cursor(prepared=TRUE)
sql = “””Insert into table(‘MemId’,
‘MemName’,‘MemAdd’,)values(‘%s’,‘%s’,‘%s’, )”””
insert_value=[(‘1021’, ‘Ronit’, ’12, Block A, Kaveri
Vihar’),
(‘1022’, ‘Smriti’, ‘12/9 Indira Puram’)]
try:
cursor.executemany(sql,insert_value)
print(cursor.rowcount,“Recordsinserted”)
db.commit()
except:
db.rollback()
cursor.close()
db.close()
Q. What of the following statement is connecting database server?
Consider the following code:
importMySQLdb
d b = M y S Q L d b. c o n n e c t (‘ l o c a l h o s t ’ ,
‘LIBMAN’,‘Admin@pwd’,‘library’)
cursor=db.cursor(prepared=TRUE)
sql = “””Insert into table(‘MemId’,
‘MemName’,‘MemAdd’,)values(‘%s’,‘%s’,‘%s’, )”””
insert_value=[(‘1021’, ‘Ronit’, ’12, Block A, Kaveri
Vihar’),
(‘1022’, ‘Smriti’, ‘12/9 Indira Puram’)]
try:
cursor.executemany(sql,insert_value)
print(cursor.rowcount,“Recordsinserted”)
db.commit()
except:
db.rollback()
cursor.close()
db.close()
Q. The role of the statement ‘cursor=db.cursor’ is: