KEMBAR78
CSProject | PDF | Software Engineering | Software
0% found this document useful (0 votes)
23 views24 pages

CSProject

The document describes a Python program that creates a school management system with databases and tables to store student and staff records. It allows users to add, search, update and delete records. The program initializes a MySQL database called pyschool and creates tables to hold student and staff data with fields like name, class, gender etc. It then provides a menu to perform CRUD operations and take user input to update the databases accordingly.

Uploaded by

om
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views24 pages

CSProject

The document describes a Python program that creates a school management system with databases and tables to store student and staff records. It allows users to add, search, update and delete records. The program initializes a MySQL database called pyschool and creates tables to hold student and staff data with fields like name, class, gender etc. It then provides a menu to perform CRUD operations and take user input to update the databases accordingly.

Uploaded by

om
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 24

1

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("create database if not exists pyschool")

mycursor.execute("use pyschool")

#creating required tables

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))")

mycursor.execute("create table if not exists pystaff(name varchar(50) not null,gender char(1),subject


varchar(25),sal int)")

mydb.commit()

while True:

print("1=enter data for new student")

print("2=enter data for new staff data")

print("3=search student data")

print("4= search staff data")

print("5=remove student record")

print("6=remove staff record")

print("7=exit")

ch=int(input("enter your choice"))

#pricedure for entering a new student record

if(ch==1):

print("all information prompted are mandatory to be filled")

name=input("enter name(limit 35 characters):")


2

classs=str(input("enter class"))

roll_no=str(input("enter roll number"))

gender=str(input("enter gender(m/f)"))

mycursor.execute("insert into pystudent values('"+name+"','"+classs+"','"+roll_no+"','"+gender+"')")

mydb.commit()

print("student record has een saved successfully")

#procedure for entering a new staff record

elif(ch==2):

name=str(input("enter staff member name"))

gender=str(input("enter gender (m/f)"))

subject=str(input("enter subject"))

sal=int(input("enter salary"))

mycursor.execute("insert into pystaff values('"+name+"','"+gender+"','"+subject+"','"+str(sal)+"')")

mydb.commit()

print("staff record has been saved successfully")

elif(ch==3):

roll_no=str(input("enter student roll_no"))

mycursor.execute("select* from pystudent where roll_no='"+roll_no+"'")

#mycursor.execute("select* from pystudent where roll_no='"+variable name+"'")

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"))

mycursor.execute("select* from pystaff where name='"+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}")

#PROCEDURE FOR DELETING STUDENT RECORD

elif(ch==5):

r_no=str(input("Enter Roll Number"))

mycursor.execute("delete from pystudent where roll_no='"+r_no+"'")

mydb.commit()

print("Student Record is successfully deleted")

#PROCEDURE FOR DELETING STAFF RECORD

elif(ch==6):

name=str(input("Enter Name"))

mycursor.execute("delete from pystaff where name='"+name+"'")

mydb.commit()

print("Staff Record is successfully deleted")

else:

break
4

Output of the project


Python 3.10.6 (tags/v3.10.6:9c7b4bd, Aug 1 2022,
21:53:49) [MSC v.1932 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license()" for
more information.

============= 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 your choice1


all information prompted are mandatory to be filled
enter name(limit 35 characters):priyanka
enter classxii
enter roll number1201
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):sneha
6

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

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 choice3
enter student roll_no1201
Name:-priyanka
Class:-xii
Roll Number:-1201
gender:-f
1=enter data for new student
2=enter data for new staff data
3=search student data
8

4= search staff data


5=remove student record
6=remove staff record
7=exit
enter your choice3
enter student roll_no1202
Name:-sneha
Class:-xii
Roll Number:-1202
gender:-f
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
9

enter your choice5


Enter Roll Number1203
Student 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 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
student record has een saved successfully
10

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):shivani
enter classxii
enter roll number1204
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
11

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):kashish
enter classxii
enter roll number1205
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
12

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

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 choice2
enter staff member nameramesh ajmera
enter gender (m/f)m
enter subjectcomputer science
enter salary40000
staff record has been saved successfully
1=enter data for new student
2=enter data for new staff data
3=search student data
4= search staff data
14

5=remove student record


6=remove staff record
7=exit
enter your choice2
enter staff member namedinesh
enter gender (m/f)m
enter subjectaccounts
enter salary50000
staff record has been 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 choice2
15

enter staff member namerajat


enter gender (m/f)m
enter subjectb.st
enter salary40000
staff record has been 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 choice2
enter staff member namelokendra
enter gender (m/f)m
enter subjectgeography
enter salary50000
16

staff record has been 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 choice6
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
17

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

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*****
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 choice2
enter staff member nameramesh ajmera
19

enter gender (m/f)m


enter subjectcomputer science
enter salary40000
staff record has been 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 choice2
enter staff member namedinesh
enter gender (m/f)m
enter subjectaccounts
enter salary50000
staff record has been saved successfully
20

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 choice2
enter staff member namerajat
enter gender (m/f)m
enter subjectb.st
enter salary40000
staff record has been saved successfully
1=enter data for new student
2=enter data for new staff data
3=search student data
4= search staff data
21

5=remove student record


6=remove staff record
7=exit
enter your choice2
enter staff member namelokendra
enter gender (m/f)m
enter subjectgeography
enter salary50000
staff record has been 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 choice6
22

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

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
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 choice7
24

You might also like