How to Create Database Menu Driven Application with OOPS in Python Part – 3
Program 1 import MySQLdb class MyDataBase: def __init__(self): self.con=MySQLdb.Connect(host=”localhost”,user=”root”,password=”root”,database=”dataflair”) print(“Connection success”) def autoId(self): self.maxid=100 sql=”select max(eid) from employee” self.cur=self.con.cursor() self.cur.execute(sql) result=self.cur.fetchone() self.maxid=result[0] self.maxid=id=self.maxid+1 def insertData(self,empname,empdept,empsal): self.autoId() sql=”insert into employee values(‘%d’,’%s’,’%s’,’%d’)” value=(self.maxid,empname,empdept,empsal) self.cur=self.con.cursor() self.cur.execute(sql %...

