OUR OWN HIGH SCHOOL, DUBAI
Python Interface with MySQL - Worksheet-2
Grade-12
1. Sartaj has created a table named Student in MySQL database SCHOOL.
• rno: Roll number (Integer)
• name: Name of the student (String)
• DOB: Date of birth (date)
• Fee: Tuition Fee (Integer)
Consider the following to establish connectivity between Python and MySQL:
• Username: root
• Password: tiger
• Host: localhost
Sartaj, now wants to display the records of students whose fee is more than 5000. Help Sartaj to write
the program in Python.
2. Sumit wants to write program in Python to update the quantity to 20 of the records whose item code
is 111 in the table named Shop in MySQL database name Keeper.
The table Shop in MySQL contains the following attributes:
• Item_code: Item Code (Integer)
• Item_name: Name of Item (String)
• Qty: Quantity of item (Integer)
• Price: Price of item (Integer)
Consider the following to establish connectivity between Python and MySQL:
• Username: admin
• Password: shopping
• Host: localhost