Q. Design a Python application that fetches only those records from Event table of menagerie database where type is Kennel.



Answer = 



import mysql.connector as a
mydb = a.connect(host="localhost",user="root",password="portal express", database = "menagerie")

cur = mydb.cursor()
run = "select * from Event where type = 'Kennel'  "
cur . execute(run)
data  = cur.fetchall()
for i in data :
    print(i)

mydb.close()


6 Comments

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

  1. please upload output too

    ReplyDelete
  2. pls upload output pls

    ReplyDelete
    Replies
    1. There is no given table, so how can i give u output .

      Delete
  3. so it means this quesn has no output

    ReplyDelete
    Replies
    1. It will give output if table is present in your database.

      Delete

Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post