Professional Documents
Culture Documents
Student Management CS Project
Student Management CS Project
1 SHAHIBAUG AHMEDABAD
Computer Science
Project
Student Management System Using
Python-MySQL Connectivity
By – HARSH MAHORI
12 A
Roll no 12106
Certificate
This is to certify that the project titled ‘Student
Management System Using Python-MySQL Connectivity’ is
prepared by HARSH MAHORI of class 12 A as a Computer
Science project for the academic session 2023-2024 under
the guidance and supervision of Mr. ASHWIN MODI.
Signature: ________________
Acknowledgement
I would like to express my gratitude to Mr. ASHWIN MODI for his
able guidance and support in completing this project. He helped
greatly with identifying and fixing my mistakes and without it,
this would have been a difficult task.
'''
-> create table Students(RollNo int(20) unique, Name varchar(30), Class int(5), House varchar(20),
Percentage float(25));
1, Abhay Kumar, 12, Shivaji, 74.8; 2, Aditi Sharma, 12, Nehru, 87.5; 3, Aditya Kumar, 12, Pratap, 98.3;
4, Aditya Ojha, 12, Nehru, 62.1
'''
import mysql.connector as m
def sel():
print("\n" + "="*80)
for i in curs:
for j in i:
print(j, end = "\t|\t")
print("\n" + "="*80)
curs = conn.cursor()
loop = 0
while loop == 0:
loop2 = 0
while loop2 == 0:
try:
inp = int(input("\nWhat would you like to do?\n 1. Insert\n 2. Delete\n 3. Update\n 4. Search\n 5.
Display all\n 6. Exit\n\n"))
loop2 = 1
except:
continue
if inp == 1:
a = tuple(input("\nPlease enter values you would like to add to the table:\n(R.No, Name, Class,
House, %age)\n").split("; "))
for i in a:
b = tuple(i.split(", "))
try:
curs.execute(ins, b)
except:
print("There's already an entry with that roll number. Please try again.")
else:
sel()
elif inp == 2:
curs.execute(de)
sel()
elif inp == 3:
if c == 1:
try:
curs.execute(u)
except:
print("There's already an entry with that roll number. Please restart and try again.")
else:
sel()
elif c == 2:
curs.execute(u, tog)
sel()
elif c == 3:
curs.execute(u)
sel()
elif c == 4:
curs.execute(u, tog)
sel()
elif c == 5:
curs.execute(u)
sel()
elif inp == 4:
rno = []
for a in curs:
for b in a:
rno.append(b)
curs.execute(s)
if d in rno:
for i in curs:
print("\n" + "="*80)
for j in i:
elif inp == 5:
sel()
elif inp == 6:
loop = 1
conn.commit()
The output for the given code is as follows-
What would you like to do?
1. Insert
2. Delete
3. Update
4. Search
5. Display all
6. Exit
Input- 1
Please enter values you would like to add to the table:
1, Abhay Kumar, 12, Shivaji, 74.8; 2, Aditi Sharma, 12, Nehru, 87.5; 3, Aditya Kumar, 12, Pratap,
98.3; 4, Aditya Ojha, 12, Nehru, 62.1
============================================================
============================================================
============================================================
============================================================
============================================================
Input- 2
Which entry would you like to delete?
Roll No: 3
============================================================
============================================================
============================================================
============================================================
Input= 3
Which entry do you want to update?
Roll No: 4
1. Roll No
2. Name
3. Class
4. House
5. Percentage
1
Enter the new roll no: 3
============================================================
=============================================================
=============================================================
=============================================================
Input= 4
Enter roll no: 3
============================================================
============================================================
Input= 5
============================================================
============================================================
============================================================
============================================================
============================================================
Input= 6
The code for ‘elif inp==6’ exits the program by breaking the loop of asking the user what they
would like to do and saving the changes using ‘conn.commit()’.