Page 1 - Home Assignment-Interface Python and MySQL
P. 1
Computer Science
Class – XII
Topic: Interface Python and MySQL
1. Fill in the blanks
a. _________________ method will return only one row from the resultset in the form
of a tuple containing a record.
b. A ____________________ refers to a logical set of records that is fetched from the
database.
c. A session between application program and the database is called
___________________.
d. A _____________________ is a special control structure that facilitates the row by
row processing of records in the result set.
e. The ___________________ is a property of cursor object that returns that returns
number of rows allowed from the cursor so far.
2. Which file do we import in Python script to establish MySQL-Python Connectivity?
3. Explain the steps for establishing MySQL connection with Python.
4. What is the significance using connect()?
5. What is the role of execute in MySQL and Python Interface?
6. Explain the following result retrieval method with example:
a. fetchone
b. fetchmany
c. fetchall
d. rowcount
7. Consider the following table:
Write Python script for:
a) Creating above table with M_Id as primary key, M_Company as not null in the
database XYZ.
b) For adding two records in the above table
c) For Increasing the price of all mobiles by 1000.
d) To display all the records of the table.