46 solutions available
Question 1Assertion. A database connection object controls the connection to a database.Reason. A connection object represents a unique session with...
Question 2Assertion. A database cursor receives all the records retrieved as per the query.Reason. A resultset refers to the records in the database...
Question 3Assertion. The database cursor and resultset have the same data yet they are different.Reason. The database cursor is a control structure...
Question 4Assertion. One by one the records can be fetched from the database directly through the database connection.Reason. The database query...
Question 5Assertion. The cursor rowcount returns how many rows have been retrieved so far through fetch...() methods.Reason. The number of rows in a...
Question 1How is database connectivity useful ?
Question 2What is a connection ?
Question 3What is a result set ?
Question 4What is the package used for creating a Python database connectivity application.
Question 5Which function/method do you use for establishing connection to database ?
Question 6Which function/method do you use for executing an SQL query ?
Question 7Which method do you use to fetch records from the result set ?
Question 1A database connection object controls the connection to the database. It represents a unique session with a database connected from within...
Question 2A database cursor is a special control structure that facilitates the row by row processing of records in the resultset, i.e., the set of...
Question 3The resultset refers to a logical set of records that are fetched from the database by executing an SQL query and made available to the...
Question 4After importing mysql.connector, first of all database connection is established using connect().
Question 5After establishing database connection, database cursor is created so that the sql query may be executed through it to obtain resultset.
Question 6The cursor.rowcount returns how many rows have been fetched so far using various fetch methods.
Question 7The running of sql query through database cursor results into all the records returned in the form of resultset.
Question 8A connectivity package such as mysql.connector must be imported before writing database connectivity Python code.
Question 9connect() method establishes a database connection from within Python.
Question 10cursor() method creates a cursor from within Python.
Question 11execute() method executes a database query from within Python.
Question 1In order to open a connection with MySQL database from within Python using mysql.connector package, ............... function is...
Question 2A database ............... controls the connection to an actual database, established from within a Python program.database...
Question 3The set of records retrieved after executing an SQL query over an established database connection is called ..................
Question 4A database ............... is a special control structure that facilitates the row by row processing of records in the...
Question 5Which of the following is not a legal method for fetching records from database from within Python?fetchone()fetchtwo()fetchall()fetchmany()
Question 6To obtain all the records retrieved, you may use <cursor>. ............... method.fetch()fetchmany()fetchall()fetchmultiple()
Question 7To fetch one record from the resultset, you may use <cursor>. ............... method.fetch()fetchone()fetchtuple()none of these
Question 8To fetch multiple records from the resultset, you may use <cursor>. ..................
Question 9To run an SQL query from within Python, you may use <cursor>. ............... method().query()execute()run()all of these
Question 10To reflect the changes made in the database permanently, you need to run <connection>. ..................
Question 1With creation of a database connection object from within a Python program, a unique session with database starts.
Question 2The sql query upon execution via established database connection returns the result in multiple chunks.
Question 3The cursor.rowcount gives the count of records in the resultset.
Question 4The cursor.rowcount returns how many rows have been so far retrieved through fetch..() methods from the cursor.
Question 5A DELETE or UPDATE or INSERT query requires commit() to reflect the changes in the database.
Question 1What are the steps to connect to a database from within a Python application ?
Question 2Write code to connect to a MySQL database namely School and then fetch all those records from table Student where grade is ' A' .
Question 3Predict the output of the following code :import mysql.connector db = mysql.connector.connect(....) cursor = db.cursor() sql1 = "update...
Question 4Explain what the following query will do ?import mysql.connector db = mysql.connector.connect(....) cursor = db.cursor() person_id =...
Question 5Explain what the following query will do ?import mysql.connector db = mysql.connector.connect(....) cursor = db.cursor() db.execute("SELECT...
Question 1Design a Python application that fetches all the records from Pet table of menagerie database.
Question 2Design a Python application that fetches only those records from Event table of menagerie database where type is Kennel.
Question 3Schema of table EMPL is shown below :EMPL (EMPNO, ENAME, JOB, MGR, HIREDATE, SAL, COMM, DEPTNO) Design a Python application to obtain a...