PDF 15dec23 0758 Merged
PDF 15dec23 0758 Merged
PDF 15dec23 0758 Merged
# making Connection
con = mysql.connector.connect(host="localhost", user="root", password="abhishek",
database="employee")
if con.is_connected():
print("connection estabalished....");
# creating database
#cursorObject.execute("CREATE DATABASE employee")
#create table
'''query='create table empdata(Id int primary key, Name varchar(200),Email_Id
varchar(40),Phone_no varchar(40),Address varchar(40),Post varchar(40),Salary int(8))'
cursorObject.execute(query)
print("created")'''
# Function to Display_Employ
def Display_Employ():
print("{:>60}".format("-->> Display Employee Record <<--"))
# query to select all rows from Employee (empdata) Table
sql = 'select * from empdata'
c = con.cursor()
for i in r:
print("Employee Id: ", i[0])
print("Employee Name: ", i[1])
print("Employee Email Id: ", i[2])
print("Employee Phone No.: ", i[3])
print("Employee Address: ", i[4])
print("Employee Post: ", i[5])
print("Employee Salary: ", i[6])
print("\n")
press = input("Press Any key To Continue..")
menu()
# Function to Update_Employ
def Update_Employ():
print("{:>60}".format("-->> Update Employee Record <<--\n"))
Id = input("Enter Employee Id: ")
# checking If Employee Id is Exit Or Not
if(check_employee(Id) == False):
print("Employee Record Not exists\nTry Again")
press = input("Press Any Key To Continue..")
menu()
else:
Email_Id = input("Enter Employee Email ID: ")
if(re.fullmatch(regex, Email_Id)):
print("Valid Email")
else:
print("Invalid Email")
press = input("Press Any Key To Continue..")
Update_Employ()
Phone_no = input("Enter Employee Phone No.: ")
if(Pattern.match(Phone_no)):
print("Valid Phone Number")
else:
print("Invalid Phone Number")
press = input("Press Any Key To Continue..")
Update_Employ()
Address = input("Enter Employee Address: ")
# Updating Employee details in empdata Table
sql = 'UPDATE empdata set Email_Id = %s, Phone_no = %s, Address = %s where Id = %s'
data = (Email_Id, Phone_no, Address, Id)
c = con.cursor()
# Function to Promote_Employ
def Promote_Employ():
print("{:>60}".format("-->> Promote Employee Record <<--\n"))
Id = input("Enter Employee Id: ")
# checking If Employee Id is Exit Or Not
if(check_employee(Id) == False):
print("Employee Record Not exists\nTry Again")
press = input("Press Any Key To Continue..")
menu()
else:
Amount = int(input("Enter Increase Salary: "))
#query to fetch salary of Employee with given data
sql = 'select Salary from empdata where Id=%s'
data = (Id,)
c = con.cursor()
# Function to Remove_Employ
def Remove_Employ():
print("{:>60}".format("-->> Remove Employee Record <<--\n"))
Id = input("Enter Employee Id: ")
# checking If Employee Id is Exit Or Not
if(check_employee(Id) == False):
print("Employee Record Not exists\nTry Again")
press = input("Press Any Key To Continue..")
menu()
else:
#query to delete Employee from empdata table
sql = 'delete from empdata where Id = %s'
data = (Id,)
c = con.cursor()
HARDWARE REQUIREMENTS:-
1.Operating System : Windows 7 And Above
2.Processor : Pentium® Dual- Core 3.20 GHz
3.RAM : 2 GB+
4.Hard Disk : Sata 40 Gb Or Above
5.Monitor : 14.1 or 15-17 inch
6.Keyboard and Mouse
SOFTWARE REQUIREMENTS:-
1.Windows OS
2.Python
3.MySQL
BIBLIOGRAPHY