Q Design a Python application to obtain a search criteria from user and then fetch records based on that from empl table. (given in chapter 12)



Answer = 


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

name = input("Enter the employee name :- ")
cur = mydb.cursor()
run = "select * from Empl where name = '{}'   ".format(name,)
cur . execute(run)
data  = cur.fetchall()
for i in data :
    print(i)

mydb.close()


2 Comments

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

Post a Comment

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

Previous Post Next Post