Project 2022
Project 2022
Project 2022
PROJECT FILE
1
SCHOOL
MANAGEMENT
2
CERTIFICATE
THIS IS CERTIFIED TO BE THE BONAFIED WORK OF
THE STUDENT IN THE COMPUTER LABORATORY
DURING THE ACADEMIC SESSION 2021-22.
HE HAS SUCCESSFULLY COMPLETED HIS WORK IN
THE COMPUTER PRACTICALS FOR THE TERM – 2
AS PRESCRIBED BY CBSE IN THE YEAR 2021-22.
………………………………….
(EXAMINER)
3
SOURCE
CODE
4
if mycon.is_connected():
print('successfully connected to mysql database')
else:
print("not connected")
cursor=mycon.cursor()
cursor.execute("create database school_management")
cursor.execute("use school_management")
student="create table student(SR_NO int primary key,name varchar(50) not null,class
varchar(20),section varchar(20),Roll_No varchar(50),address varchar(50),mobile_no
int(15))"
cursor.execute(student)
teacher="create table Teacher(Teacher_ID int Primary Key,Name varchar(50),Subject
varchar(20),salary varchar(10),Address varchar(50),Mobile_No int(15),Account_No
varchar(10))"
cursor.execute(teacher)
CATTEND="create table Class_Attendance(Date datetime,Class varchar(20),name
varchar(50),status varchar(15))"
cursor.execute(CATTEND)
TATTEND="create table Teacher_Attendance(Date datetime,name varchar(50),status
varchar(15))"
cursor.execute(TATTEND)
FEES="create table Fees(SR_No int Primary Key,Name varchar(50),Class
varchar(20),Roll_No varchar(10),Month varchar(30),Fees int,Date datetime)"
cursor.execute(FEES)
SALARY="create table Salary(Teacher_ID int Primary Key,Name varchar(50),Month
varchar(30),Status varchar(50))"
cursor.execute(SALARY)
def addstud():
j=int(input("Enter Sr. No-"))
a=input("Enter Student's Name-")
b=input("Enter Class-")
y=input("Enter Section-")
5
c=input("Enter Roll No.-")
d=input("Enter Address-")
e=int(input("Enter Mobile No.-"))
val=(j,a,b,y,c,d,e)
sql="insert into Student values(%s,%s,%s,%s,%s,%s,%s)"
cursor.execute(sql,val)
mycon.commit()
print("Data Entered Successfully")
print("~"*60)
def removestud():
c=int(input("SR_No of student-"))
val=(c,)
sql="delete from Student where SR_No=%s"
cursor.execute(sql,val)
mycon.commit()
print("Data Updated")
print("~"*60)
def addteac():
o=int(input("Enter Teacher_ID-"))
x=input("Enter Teacher's Name-")
y=input("Enter Teacher's subject-")
z=input("Enter Salary-")
q=input("Enter Address-")
w=int(input("Enter Mobile No.-"))
u=input("Enter Account No.-")
val=(o,x,y,z,q,w,u)
sql="insert into Teacher values(%s,%s,%s,%s,%s,%s,%s)"
cursor.execute(sql,val)
mycon.commit()
6
print("Data Entered Successfully")
print("~"*60)
def removeteac():
x=int(input("Teacher_ID of the teacher-"))
val=(x,)
sql="delete from Teacher where Teacher_ID=%s"
cursor.execute(sql,val)
mycon.commit()
print("Data Updated")
print("~"*60)
def classatt():
da=input("Enter Date-")
c=input("Enter class-")
n=input("Enter Name of student-")
st=input("enter current day status(present/absent)")
val=(da,c,n,st)
sql="insert into Class_Attendance values(%s,%s,%s,%s)"
cursor.execute(sql,val)
mycon.commit()
print("Data entered successfully")
print("~"*60)
def teacheratt():
da=input("Enter Date-")
n=input("Enter Name of the teacher-")
st=input("enter current day status(present/absent)")
val=(da,n,st)
sql="insert into Teacher_Attendance values(%s,%s,%s)"
cursor.execute(sql,val)
mycon.commit()
7
print("Data entered successfully")
print("~"*60)
def submitfee():
j=int(input("SR_No of student-"))
a=input("Enter Student's Name-")
b=input("Enter Class-")
c=input("Enter Roll No.-")
m=input("Month and year-")
f=input("Fees-")
da=input("Enter Date-")
val=(j,a,b,c,m,f,da)
sql="insert into Fees values(%s,%s,%s,%s,%s,%s,%s)"
cursor.execute(sql,val)
mycon.commit()
print("Data Entered Successfully")
print("~"*60)
def salpays():
g=int(input("Enter Teacher_ID of the teacher-"))
x=input("Enter Teacher's Name-")
j=input("Month-")
l=input("paid/not paid")
val=(g,x,j,l)
sql="insert into Salary values(%s,%s,%s,%s)"
cursor.execute(sql,val)
mycon.commit()
print("Data Entered Successfully")
print("~"*60)
def disclass():
c=input("Enter Class-")
8
v=input("Enter Section-")
val=(c,v)
sql="select * from Student where Class=%s and Section=%s"
cursor.execute(sql,val)
data=cursor.fetchall()
for i in data:
print("SR_No-",i[0])
print("NAME-",i[1])
print("CLASS-",i[2])
print("SECTION-",i[3])
print("ROLL NO.-",i[4])
print("ADDRESS-",i[5])
print("MOBILE NO.-",i[6])
print("~"*30)
print("*"*60)
def disteac():
sql="select * from Teacher"
cursor.execute(sql)
data=cursor.fetchall()
for i in data:
print("TEACHER'S ID:-",i[0])
print("NAME:-",i[1])
print("SUBJECT:-",i[2])
print("SALARY:-",i[3])
print("ADDRESS:-",i[4])
print("MOBILE NO.:-",i[5])
print("ACCOUNT NO.:-",i[6])
print("~"*30)
print("*"*60)
9
def disstudent():
sql="select * from student"
cursor.execute(sql)
data=cursor.fetchall()
for i in data:
print("SR_No-",i[0])
print("NAME-",i[1])
print("CLASS-",i[2])
print("SECTION-",i[3])
print("ROLL NO.-",i[4])
print("ADDRESS-",i[5])
print("MOBILE NO.-",i[6])
print("~"*30)
print("*"*60)
def main():
while True:
print("The available choices are:")
print("\t\t\tLUCKNOW PUBLIC SCHOOL\t\t\t")
print('''1-to Add student
2-to Remove student
3-to Add teacher
4-to Remove Teacher
5-to enter children Attendance
6-to enter Teacher Attendance
7-to Submit Fees
8-to enter Salary Pay
9-to Display students of a particular class and section
10-to see List of Teachers
10
11-to display all students
12-to terminate the program''')
ch=int(input("enter your choice:-"))
if ch==1:
addstud()
elif ch==2:
removestud()
elif ch==3:
addteac()
elif ch==4:
removeteac()
elif ch==5:
classatt()
elif ch==6:
teacheratt()
elif ch==7:
submitfee()
elif ch==8:
salpays()
elif ch==9:
disclass()
elif ch==10:
disteac()
elif ch==11:
disstudent()
elif ch==12:
break
else:
print("Invalid choice entered")
11
def password():
passw=input("Enter password:-")
if passw=="1234":
main()
else:
print("wrong password")
password()
password()
OUTPUTS
12
13
14
15
16
17
18
19
20
21
Thank
You
22