Professional Documents
Culture Documents
CSProject
CSProject
print("******SCHOOL MANAGEMENT*****")
#creating database
import mysql.connector
mydb=mysql.connector.connect(host="localhost",user="root",passwd="r.ajmera@000")
mycursor=mydb.cursor()
mycursor.execute("use pyschool")
mycursor.execute("create table if not exists pystudent(name varchar(50) not null,class varchar(25) not
null,roll_no varchar(25),gender char(1))")
mydb.commit()
while True:
print("7=exit")
if(ch==1):
classs=str(input("enter class"))
gender=str(input("enter gender(m/f)"))
mydb.commit()
elif(ch==2):
subject=str(input("enter subject"))
sal=int(input("enter salary"))
mydb.commit()
elif(ch==3):
for i in mycursor:
name,classs,roll_no,gender=i
print(f'Name:-{name}')
print(f'Class:-{classs}')
print(f'Roll Number:-{roll_no}')
print(f'gender:-{gender}')
3
elif(ch==4):
name=str(input("Enter Name"))
for i in mycursor:
name,gender,dep,sal=i
print(f"Name:-{name}")
print(f"gender:-{gender}")
print(f"department:-{dep}")
print(f"sal:-{sal}")
elif(ch==5):
mydb.commit()
elif(ch==6):
name=str(input("Enter Name"))
mydb.commit()
else:
break
4
============= RESTART:
C:\Users\pc\Desktop\school_management_pro.py
============
******SCHOOL MANAGEMENT*****
1=enter data for new student
2=enter data for new staff data
3=search student data
4= search staff data
5=remove student record
6=remove staff record
7=exit
5
enter classxii
enter roll number1202
enter gender(m/f)f
student record has een saved successfully
1=enter data for new student
2=enter data for new staff data
3=search student data
4= search staff data
5=remove student record
6=remove staff record
7=exit
enter your choice1
all information prompted are mandatory to be filled
enter name(limit 35 characters):anushka
enter classxii
enter roll number1203
enter gender(m/f)f
7
7=exit
enter your choice1
all information prompted are mandatory to be filled
enter name(limit 35 characters):anshul
enter classxii
enter roll number1206
enter gender(m/f)m
student record has een saved successfully
1=enter data for new student
2=enter data for new staff data
3=search student data
4= search staff data
5=remove student record
6=remove staff record
7=exit
enter your choice
******SCHOOL MANAGEMENT*****
13
7=exit
enter your choice4
Enter Namerajat
Name:-rajat
gender:-m
department:-b.st
sal:-40000
1=enter data for new student
2=enter data for new staff data
3=search student data
4= search staff data
5=remove student record
6=remove staff record
7=exit
enter your choice4
Enter Nameramesh
1=enter data for new student
18
Enter Namelokendra
Staff Record is successfully deleted
1=enter data for new student
2=enter data for new staff data
3=search student data
4= search staff data
5=remove student record
6=remove staff record
7=exit
enter your choice4
Enter Namerajat
Name:-rajat
gender:-m
department:-b.st
sal:-40000
1=enter data for new student
2=enter data for new staff data
23