AVB PUBLIC SCHOOL
SESSION:2024-2025
COMPUTER SCIENCE
PROJECT
SCHOOL MANAGEMENT SYSTEM
NAME: SANGHAM SAGAR
CLASS:XIIA
ROLL NO:
CERTIFICATE OF COMPLETION
Project: SCHOOL MANANGEMENT SYSTEM
This is to certify that SANGHAM SAGAR has
successfully completed the project "SCHOOL
MANANGEMNT SYSTEM” as part of the Class
12th Computer Science curriculum for the
academic year 2024-2025. The project was
developed under the guidance of
MRS.KAVITA NEGI (COMPUTER SCIENCE
TEACHER)
Date:12/11/2024
Signature of Subject Teacher:
__________________
ACKNOWLEDGEMENT
I would like to express my heartfelt appreciation
to all
those who have contributed to the successful
completion of this project.
I am deeply indebted to MRS.KAVITA NEGI, my
Computer Science teacher, for their exceptional
guidance, encouragement and support
throughout the course of this project.
Their unwavering motivation and insightful
feedback were vital in shaping the development
and successful completion of this project.
I also wish to extend my thanks to my sister for
her
valuable contributions, assistance, and for
providing the
necessary resources that helped enhance my
understanding and skills in this subject.
Lastly, I would like to acknowledge my family and
friends
for their continuous support, patience, and
understanding throughout the course of this
project.
1
INDEX
S.no CONTENT PAGE NO
1. INTRODUCTION 4-6
2. ABOUT PROJECT 7-9
3. IMPLEMENTATION 10-31
4. OUTPUT 32-35
2
INTRODUCTION
About Python
Python is a high-level, interpreted programming language that
is known for its
easy-to-read syntax and versatility. It was created by Guido van
Rossum and first released in 1991. Python emphasizes code
readability and allows developers to write fewer lines of code to
accomplish tasks compared to other programming languages.
Key Features of Python :
Interpreted Language: Python code is executed line-by-
line, which makes debugging easier.
Cross-Platform: Python can run on various operating
systems like Windows, macOS, and Linux without
modification.
Extensive Libraries: Python provides a vast collection of
libraries for various tasks such as web development, data
analysis, machine learning, automation, etc.
Dynamic Typing: Variables do not require explicit
declarations, as the interpreter determines the type at
runtime.
Object-Oriented and Procedural: Python supports both
object-oriented and procedural programming paradigms.
3
Python is often chosen for applications such as web
development, data analysis, artificial intelligence, machine
learning, and automation due to its simplicity and wide
support.
About MySQL
MySQL is an open-source relational database management
system (RDBMS) based on Structured Query Language (SQL). It
is used to store, manage, and retrieve data from databases.
MySQL is widely popular due to its speed, reliability, and ease
of use.
Key Features of MySQL:
Open Source: MySQL is freely available under the GNU
General Public License (GPL), making it an accessible
choice for both small and large-scale applications.
Relational Database: MySQL uses tables to store data and
relationships between them, which is essential for
organizing data efficiently.
Scalability: MySQL can handle large databases and is used
by many large websites and applications.
Support for SQL: MySQL supports a variety of SQL
commands for querying and manipulating data, such as
SELECT, INSERT, UPDATE, DELETE, etc.
4
Cross-Platform: MySQL runs on various operating systems,
including Windows, Linux, and macOS.
MySQL is commonly used in applications such as content
management systems
(CMS), e-commerce platforms, and data-driven websites.
About Python and MySQL Connectivity
Connecting Python with MySQL allows developers to create
dynamic and interactive applications by enabling them to store
and retrieve data from a MySQL database. This integration is
done using libraries such as mysqlconnector-python, PyMySQL,
or SQL Alchemy, which provide an interface between Python
programs and MySQL databases.
Process of Connecting Python with MySQL:
1. Install MySQL Connector: First, you need to install a
Python library that supports MySQL. The most commonly
used one is mysql-connectorpython, which can be
installed using pip.
2. Establish a Connection: In Python, you can connect to the
MySQL database by creating a connection object that
holds the connection information such as host, username,
password, and database name.
3. Create a Cursor Object: After establishing a connection,
you can create a cursor object that allows you to execute
SQL queries.
4. Execute Queries: With the cursor object, you can execute
SQL queries like SELECT, INSERT, UPDATE, and DELETE to
interact with the database.
5
5. Close the Connection: After performing the database
operations, it is important to close the cursor and the
connection to release resources.
Benefits of Python and MySQL connectivity:
Data Handling: Python's powerful data handling
capabilities can be paired with MySQL's efficient storage
and retrieval, allowing the development of data-driven
applications.
Automation: Python can be used to automate database
operations such as backups, updates, and reports.
Scalability: Combining Python's ability to handle complex
logic with MySQL's scalability makes it ideal for building
applications that require large amounts of data to be
processed.
ABOUT PROJECT
Overview of the Project
The School Management System is a Python-based project designed
to streamline the management of student data in educational
institutions. By connecting to a MySQL database, it allows
administrators to add, view, update, and delete student records
efficiently. The project ensures that student information is securely
stored and easily accessible for everyday operations, reducing
manual record-keeping tasks.
The system uses mysql.connector for database connectivity, making it
capable of handling a large volume of data and performing real-time
operations.
6
Objective of the Project
The main objectives of this project are:
To create a system for managing of student data and
entry .
To automate attendance and period.
To provide a platform for teacher to enter attendance
and result.
Problem Statement
The problem this project aims to solve is the manual and error-
prone
management of school operations. School often struggle with
efficiently
managing student entry, student detail, and admission no. This
system
automates these tasks, ensuring smooth operations and better
customer
satisfaction.
Functions Used
The project employs several functions, each dedicated to specific operations :
Function Name Purpose
Add_Records() Adds a new student record to the database.
Show_Stu_Details() Displays all student records from the database.
Search_Stu_Details()
Searches for a specific student record based on roll
number.
Delete_Stu_Details() Deletes a student record from the database.
Edit_Stu_Details()
Provides options to edit specific fields in a student
record.
edit_session() Updates the academic session for a student.
edit_name() Updates the student’s name.
edit_class() Updates the student’s class.
edit_section() Updates the student’s section.
edit_Rollno() Updates the roll number of a student.
edit_sub1(), edit_sub2(), Updates the subjects associated with the student.
7
Function Name Purpose
edit_sub3()
Queries Used
The project uses a variety of SQL queries for database operations:
Operation SQL Query Example
INSERT INTO student (session, stname, stclass, stsec, stroll,
Insert Data sub1, sub2, sub3) VALUES (...);
Retrieve All SELECT * FROM student;
Data
Search by Roll SELECT * FROM student WHERE stroll='roll_number';
No
Delete Data DELETE FROM student WHERE stroll='roll_number';
UPDATE student SET column_name='new_value' WHERE
Update Data stroll='roll_number';
This project demonstrates the integration of Python and MySQL to create a
functional and efficient solution for managing school records. The modular
design, coupled with robust SQL queries, ensures scalability and ease of use,
making it a valuable tool for educational institutions.
Inbuilt Functions Used
In the School Management System, several inbuilt functions
from the
Mysql.connector library are used to interact with the MySQL
database. Below are the inbuilt functions and their respective
roles in the system:
1. Mysql.connector. Connect ()
This function is used to establish a connection between
the Python program and the MySQL database. It requires
parameters such as the host, username, password, and
database name.
It returns a connection object that is used for further
interaction with the database.
2. Cursor. Execute ()
8
The execute () function is used to run SQL queries on the
database. It is used for executing various SQL statements
like SELECT, INSERT, UPDATE, and DELETE.
For example, it executes a query to fetch customer details
or to insert new customer records into the database.
3. Cursor.fetchall ()
The fetchall () function is used to retrieve all rows from the
result of a SELECT query. It returns a list of tuples, where
each tuple represents a record from the database.
This is used when viewing all customers or available
rooms. For example, after executing a SELECT query to
retrieve customers, fetchall () is called to get all customer
records.
4. Cursor.fetchone ()
The fetchone () function retrieves a single record from the
result of a SELECT query. It returns a tuple for the first
matching row.
It is used when searching for a customer by ID or fetching
a single available room.
5. Connection. Commit ()
The commit () function is used to save (commit) the
changes made during the execution of SQL queries like
INSERT, UPDATE, or DELETE.
It ensures that any changes made to the database, such
as adding a customer or assigning a room, are saved
permanently.
6. Connection. Close ()
The close () function is used to close the database
connection once all operations are completed. It ensures
that the connection to the database is properly terminated
and resources are freed.
7. Cursor. Close ()
The close () function for the cursor is used to close the
cursor object after the database operations are done,
ensuring that the cursor is properly released.
IMPLEMENTATION
import main_menu
import student_data
9
import mysql.connector as co
def STU_MENU():
while True:
print("\t\t..........................................................")
print("\t\t*****Welcome To School Management
System*****")
print("\t\t..........................................................")
print("\n\t\t*****AVB PUBLIC SCHOOL *****")
print("1: Add Student Record")
print("2: Show Student Details")
print("3: Search Student Record")
print("4: Delete student records")
print("5: Edit student record")
print("6: Exit")
print("\t\t----------------------------------------------------------")
choice = int(input("Enter your choice:"))
if choice == 1:
student_data.Add_Records()
elif choice == 2:
student_data.Show_Stu_Details()
elif choice == 3:
student_data.Search_Stu_Details()
elif choice == 4:
student_data.Delete_Stu_Details()
elif choice == 5:
student_data.Edit_Stu_Details()
elif choice == 6:
return
else:
print("Error: Invalid Choice. Try again.....")
conti = "Press any key to return to Main Menu"
def Add_Records():
try:
mycon = co.connect(host="localhost", user="root",
passwd="1234", database="xyz")
cursor = mycon.cursor()
session = input('Enter academic session (e.g., 2019-20):')
stname = input('Enter Student Name')
stclass = input('Enter class:')
stsec = input('Enter section:')
10
stroll = input('Enter roll no:')
sub1 = input('Enter subject1:')
sub2 = input('Enter subject2:')
sub3 = input('Enter subject3:')
query = "insert into student(session, stname, stclass,
stsec, stroll, sub1, sub2, sub3) values('{}', '{}', '{}', '{}', '{}',
'{}', '{}', '{}')".format(session, stname, stclass, stsec, stroll,
sub1, sub2, sub3)
cursor.execute(query)
mycon.commit()
mycon.close()
cursor.close()
print('Record has been saved in the student table')
except:
print('error')
def Show_Stu_Details():
mycon = co.connect(host="localhost", user="root",
passwd="1234", database="xyz")
cursor = mycon.cursor()
cursor.execute("select * from student")
data = cursor.fetchall()
for row in data:
print(row)
def Search_Stu_Details():
mycon = co.connect(host="localhost", user="root",
passwd="1234", database="xyz")
cursor = mycon.cursor()
ac = input('Enter Roll Number')
st = "select * from student where stroll='%s'" % (ac)
cursor.execute(st)
data = cursor.fetchall()
print(data)
def Delete_Stu_Details():
mycon = co.connect(host="localhost", user="root",
passwd="1234", database="xyz")
cursor = mycon.cursor()
ac = input('Enter Roll Number')
st = "delete from student where stroll='%s'" % (ac)
cursor.execute(st)
11
mycon.commit()
print('Data deleted successfully')
def Edit_Stu_Details():
mycon = co.connect(host="localhost", user="root",
passwd="1234", database="xyz")
cursor = mycon.cursor()
print("1: Edit session")
print("2: Edit name")
print("3: Edit class")
print("4: Edit section")
print("5: Edit Roll no")
print("6: Edit sub1")
print("7: Edit sub2")
print("8: Edit sub3")
print("9: Return")
print("\t\t----------------------------------------------------------")
choice = int(input("Enter your choice"))
if choice == 1:
student_data.edit_session()
elif choice == 2:
student_data.edit_name()
elif choice == 3:
student_data.edit_class()
elif choice == 4:
student_data.edit_section()
elif choice == 5:
student_data.edit_Rollno()
elif choice == 6:
student_data.edit_sub1()
elif choice == 7:
student_data.edit_sub2()
elif choice == 8:
student_data.edit_sub3()
elif choice == 9:
return
else:
print("Error: Invalid Choice. Try again.....")
conti = "Press any key to return to "
def edit_session():
12
mycon = co.connect(host="localhost", user="root",
passwd="1234", database="xyz")
cursor = mycon.cursor()
ac = input('Enter Roll no')
nm = input('Enter correct session')
st = "update student set session='%s' where stroll='%s'" %
(nm, ac)
cursor.execute(st)
mycon.commit()
print('Data updated successfully')
def edit_name():
mycon = co.connect(host="localhost", user="root",
passwd="1234", database="xyz")
cursor = mycon.cursor()
ac = input('Enter Roll no')
nm = input('Enter correct name')
st = "update student set stname='%s' where stroll='%s'" %
(nm, ac)
cursor.execute(st)
mycon.commit()
print('Data updated successfully')
def edit_class():
mycon = co.connect(host="localhost", user="root",
passwd="1234", database="xyz")
cursor = mycon.cursor()
ac = input('Enter Roll no')
nm = input('Enter correct class')
st = "update student set stclass='%s' where stroll='%s'" %
(nm, ac)
cursor.execute(st)
mycon.commit()
print('Data updated successfully')
def edit_section():
mycon = co.connect(host="localhost", user="root",
passwd="1234", database="xyz")
cursor = mycon.cursor()
ac = input('Enter Roll no')
nm = input('Enter correct section')
13
st = "update student set stsec='%s' where stroll='%s'" %
(nm, ac)
cursor.execute(st)
mycon.commit()
print('Data updated successfully')
def edit_Rollno():
mycon = co.connect(host="localhost", user="root",
passwd="1234", database="xyz")
cursor = mycon.cursor()
ac = input('Enter Roll no')
nm = input('Enter correct Roll no.')
st = "update student set stroll='%s' where stroll='%s'" %
(nm, ac)
cursor.execute(st)
mycon.commit()
print('Data updated successfully')
def edit_sub1():
mycon = co.connect(host="localhost", user="root",
passwd="1234", database="xyz")
cursor = mycon.cursor()
ac = input('Enter Roll no')
nm = input('Enter correct subject1')
st = "update student set sub1='%s' where stroll='%s'" %
(nm, ac)
cursor.execute(st)
mycon.commit()
print('Data updated successfully')
def edit_sub2():
mycon = co.connect(host="localhost", user="root",
passwd="1234", database="xyz")
cursor = mycon.cursor()
ac = input('Enter Roll no')
nm = input('Enter correct subject2')
st = "update student set sub2='%s' where stroll='%s'" %
(nm, ac)
cursor.execute(st)
mycon.commit()
print('Data updated successfully')
14
def edit_sub3():
mycon = co.connect(host="localhost", user="root",
passwd="1234", database="xyz")
cursor = mycon.cursor()
ac = input('Enter Roll no')
nm = input('Enter correct subject3')
st = "update student set sub3='%s' where stroll='%s'" %
(nm, ac)
cursor.execute(st)
mycon.commit()
print('Data updated successfully')
import main_menu
import admission
import student_data
while True:
print("\t\t..........................................................")
print("\t\t*****Welcome To School Management
System*****")
print("\t\t..........................................................")
print("\n\t\t*****AVB PUBLIC SCHOOL *****")
print("1:Admission")
print("2:Student Data")
print("3:Exit")
print("\t\t----------------------------------------------------------")
choice = int(input("Enter your choice:"))
if choice == 1:
admission.ADM_MENU()
elif choice == 2:
student_data.STU_MENU()
elif choice == 3:
break
else:
print("Error:Invalid Choice try again.....")
conti = input("press any key to continue")
import main_menu
import admission
import mysql.connector as co
def ADM_MENU():
while True:
15
print("\t\t..........................................................")
print("\t\t*****Welcome To School Management
System*****")
print("\t\t..........................................................")
print("\n\t\t*****AVB PUBLIC SCHOOL*****")
print("1: Admission Details")
print("2: Show admission details")
print("3: Search")
print("4: Deletion of records")
print("5: Update Admission Details")
print("6: Return")
print("\t\t----------------------------------------------------------")
choice = int(input("Enter your choice:"))
if choice == 1:
admission.admn_details()
elif choice == 2:
admission.show_admn_details()
elif choice == 3:
admission.search_admn_details()
elif choice == 4:
admission.delete_admn_details()
elif choice == 5:
admission.edit_admn_details()
elif choice == 6:
return
else:
print("Error: Invalid Choice try again.....")
conti = "Press any key to return to Main Menu"
def admn_details():
try:
mycon = co.connect(host="localhost", user="root",
passwd="1234", database="xyz")
cursor = mycon.cursor()
adno = input('Enter Admission number')
rno = int(input('Enter Roll no'))
sname = input('Enter student name')
address = input('Enter address')
phon = input('Enter phone number')
clas = input('Enter class')
16
query = "insert into admission(adno, rno, sname, address,
phon, clas) values('{}', {}, '{}', '{}', '{}', '{}')".format(adno,
rno, sname, address, phon, clas)
cursor.execute(query)
mycon.commit()
mycon.close()
cursor.close()
print('Record has been saved in admission table')
except:
print('error')
def show_admn_details():
mycon = co.connect(host="localhost", user="root",
passwd="1234", database="xyz")
cursor = mycon.cursor()
cursor.execute("select * from admission")
data = cursor.fetchall()
for row in data:
print(row)
def search_admn_details():
mycon = co.connect(host="localhost", user="root",
passwd="1234", database="xyz")
cursor = mycon.cursor()
ac = input('Enter Admission Number')
st = "select * from admission where adno='%s'" % (ac)
cursor.execute(st)
data = cursor.fetchall()
print(data)
def delete_admn_details():
mycon = co.connect(host="localhost", user="root",
passwd="1234", database="xyz")
cursor = mycon.cursor()
ac = input('Enter Admission no')
st = "delete from admission where adno='%s'" % (ac)
cursor.execute(st)
mycon.commit()
print('Data deleted successfully')
def edit_admn_details():
17
mycon = co.connect(host="localhost", user="root",
passwd="1234", database="xyz")
cursor = mycon.cursor()
print("1: Edit name")
print("2: Edit Address")
print("3: Phone number")
print("4: Return")
print("\t\t----------------------------------------------------------")
choice = int(input("Enter your choice"))
if choice == 1:
admission.edit_name()
elif choice == 2:
admission.edit_address()
elif choice == 3:
admission.edit_phno()
elif choice == 4:
return
else:
print("Error: Invalid Choice try again.....")
conti = "Press any key to return to "
def edit_name():
mycon = co.connect(host="localhost", user="root",
passwd="1234", database="xyz")
cursor = mycon.cursor()
ac = input('Enter Admission Number')
nm = input('Enter correct name')
st = "update admission set sname='%s' where adno='%s'" %
(nm, ac)
cursor.execute(st)
mycon.commit()
print('Data updated successfully')
def edit_address():
mycon = co.connect(host="localhost", user="root",
passwd="1234", database="xyz")
cursor = mycon.cursor()
ac = input('Enter Admission Number')
nm = input('Enter correct address')
st = "update admission set address='%s' where adno='%s'"
% (nm, ac)
18
cursor.execute(st)
mycon.commit()
print('Data updated successfully')
def edit_phno():
mycon = co.connect(host="localhost", user="root",
passwd="1234", database="xyz")
cursor = mycon.cursor()
ac = input('Enter Admission Number')
nm = input('Enter correct phone number')
st = "update admission set phno='%s' where adno='%s'" %
(nm, ac)
cursor.execute(st)
mycon.commit()
print('Data updated successfully')
19
20
21
22
Output
23
24
25