[Type B] Chapter 16 | Python application that fetches only those records from Event table of Menagerie database where type is Kennel.

Here is class 12 computer science Unit 16 solutions for Sumita Arora back exercise assignment. Below includes both textual and video solutions wherever required. View all the answers in assignment for chapter 16 and for all chapters here.

Sumita Arora Solutions for all lessons here.

Question 2: Design a Python application that fetches only those records from Event table of menagerie database where type is Kennel.
$ import mysql.connector as sql    #import the sql package
$ obj = sql.connect(host="localhost", user="root", passwd="Pass", database="menagerie")
$ cursor = obj.cursor()     #create a cursor to the dataset object
$ cursor.execute("SELECT * FROM Event WHERE type='Kennel'")    #execute the query
$ data = cursor.fetchall()   #return all rows from the result set
$ print(data)      # print all the rows

Clear Doubts with Computer Tutor
In case you’re facing problems in understanding concepts, writing programs, solving questions, want to learn fun facts | tips | tricks or absolutely anything around computer science, feel free to join CTs learner-teacher community: students.computertutor.in

You cannot copy content of this page