Google Keep Document
Google Keep Document
connector as con
print("------------------------------------------------------------
---")
d = con.connect(host="localhost", user="root",
password="abhi08",
database="STUDENT_MANAGEMENT_SYSTEM")
c = d.cursor()
c.execute("SELECT * FROM STUDENT_DETAILS WHERE NAME
LIKE '%{}%'".format(k))
a = c.fetchall()
if len(a) >= 1:
for i in a:
print("Admission no:", i[0])
print("Name is:", i[1])
print("Sex:", i[2])
print("Class:", i[3])
print("Sec:", i[4])
print("Phone number is:", i[5])
print("Email_id:", i[6])
print("Stream is:", i[7])
print("----------------------------------------------------")
else:
print("Student Details Not Found")
d.commit()
if opt == 1:
print("---------------------------------------------------")
print("You are inside updating name.")
q = input("Enter ADMISSION_NUMBER whose data you want
to update: ")
l = input("Enter your updated name: ")
c.execute("UPDATE STUDENT_DETAILS SET NAME='{}' WHERE
ADMISSION_NUMBER={}".format(l, q))
d.commit()
elif opt == 2:
print("---------------------------------------------------")
print("You are inside updating Gender.")
p = input("Enter name whose data you want to update: ")
l = input("Enter your updated Gender: ")
c.execute("UPDATE STUDENT_DETAILS SET SEX='{}' WHERE
NAME='{}'".format(l, p))
d.commit()
elif opt == 3:
print("---------------------------------------------------")
print("You are inside updating class.")
m = input("Enter name whose data you want to update: ")
n = input("Enter your updated class: ")
c.execute("UPDATE STUDENT_DETAILS SET CLASS={} WHERE
NAME='{}'".format(n, m))
d.commit()
elif opt == 4:
print("---------------------------------------------------")
print("You are inside updating section.")
y = input("Enter name whose data you want to update: ")
e = input("Enter your updated section: ")
c.execute("UPDATE STUDENT_DETAILS SET SEC='{}' WHERE
NAME='{}'".format(e, y))
d.commit()
elif opt == 5:
print("---------------------------------------------------")
print("You are inside updating phone number.")
h = input("Enter name whose data you want to update: ")
r = input("Enter your updated phone number: ")
c.execute("UPDATE STUDENT_DETAILS SET
PHONE_NUMBER={} WHERE NAME='{}'".format(r, h))
d.commit()
elif opt == 6:
print("---------------------------------------------------")
print("You are inside updating email_id.")
j = input("Enter name whose data you want to update: ")
k = input("Enter your updated email_id: ")
c.execute("UPDATE STUDENT_DETAILS SET EMAIL_ID='{}'
WHERE NAME='{}'".format(k, j))
d.commit()
elif opt == 7:
print("---------------------------------------------------")
print("You are inside updating stream.")
f = input("Enter name whose data you want to update: ")
z = input("Enter your updated stream: ")
c.execute("UPDATE STUDENT_DETAILS SET STREAM='{}'
WHERE NAME='{}'".format(z, f))
d.commit()
else:
print("Invalid input")
update_details()
for i in s:
print("MARKS:", i[8])
print("-----------------------------------------------------")
d.commit()
d = con.connect(host="localhost", user="root",
password="abhi08",
database="STUDENT_MANAGEMENT_SYSTEM")
c = d.cursor()
sq = "INSERT INTO STUDENT_DETAILS VALUES({}, '{}', '{}', {}, '{}', {},
'{}', '{}', {})".format(a, n, r, i, p, t, u, w, m)
c.execute(sq)
d.commit()
print("Student data added successfully")
d = con.connect(host="localhost", user="root",
password="abhi08",
database="STUDENT_MANAGEMENT_SYSTEM")
c = d.cursor()
c.execute("SELECT NAME FROM STUDENT_DETAILS")
students = c.fetchall()
if len(students) >= 1:
for student in students:
print("Name:", student[0])
print("--------------------------------------------------------
-------")
else:
print("No student details found")
d.commit()
def admin():
while True:
print("*************** WELCOME TO STUDENT MANAGEMENT
*****************")
print("--------------------------------------------------------
-------")
print("1. Search student details")
print("2. Update student details")
print("3. View student details")
print("4. Add student details")
print("5. Delete student details")
print("6. List all student names")
print("7. Exit")
ch = int(input("Your choice: "))
if ch == 1:
search_student()
elif ch == 2:
update_details()
elif ch == 3:
view_marks()
elif ch == 4:
add_student()
elif ch == 5:
delete_student()
elif ch == 6:
list_all_students()
elif ch == 7:
break
else:
print("Invalid input")
def user():
while True:
print("*************** WELCOME TO STUDENT MANAGEMENT
**************")
print("1. Search your details")
print("2. View details")
print("3. Exit")
ch = int(input("What is your choice: "))
if ch == 1:
search()
elif ch == 2:
view_marks()
elif ch == 3:
break
else:
print("Invalid input")
d = con.connect(host="localhost", user="root",
password="abhi08",
database="STUDENT_MANAGEMENT_SYSTEM")
c = d.cursor()
c.execute("SELECT * FROM STUDENT_DETAILS WHERE NAME
LIKE '%{}%'".format(k))
a = c.fetchall()
if len(a) >= 1:
for i in a:
print("Admission no:", i[0])
print("Name is:", i[1])
print("Sex:", i[2])
print("Class:", i[3])
print("Sec:", i[4])
print("Phone number is:", i[5])
print("Email_id:", i[6])
print("Stream is:", i[7])
print("----------------------------------------------------")
else:
print("Student Details Not Found")
d.commit()