how to fetch one record from database in python

0

How to Fetch One Record From Database in Python

Program 1 # Program to search one record (based on PK) import MySQLdb try: con=MySQLdb.connect(host=’localhost’,user=’root’,password=’root’,database=’college’) #print(“Data base connected”) empid=int(input(“Enter employee id for search: “)) sql=”select * from employee where eid={}” sql=sql.format(empid) cur=con.cursor() cur.execute(sql) result=cur.fetchone()...