Q. Design a Python application that fetches all the records from Pet table of menagerie database.


Answer = 

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

cur = mydb.cursor()
run = "select * from PET "
cur . execute(run)
data  = cur.fetchall()
for i in data :
    print(i)

mydb.close()


Post a Comment

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

Previous Post Next Post