Student Management System1
Student Management System1
System
Objective:
The purpose of this Python-based Student Management
System is to provide an efficient and user-friendly interface
for managing data related to students, teachers,
attendance, fees, and salary records in an educational
institution. The system is designed to interact with a
MySQL database to store and retrieve information
securely.
---
Features and Functionality:
1. **Add Student Records:**
- Collects student details such as name, class, roll
number, address, and phone number.
- Stores these details in the `student` table of the
database.
2. **Remove Student Records:**
- Deletes a student's record based on their class and roll
number.
3. **Add Teacher Records:**
- Records teacher details like name, post, salary,
address, phone number, and account number in the
`teacher` table.
4. **Remove Teacher Records:**
- Deletes a teacher's record based on their name and
account number.
5. **Record Attendance:**
- Records student and teacher attendance on a specific
date.
- Stores absent students in the `cattendance` table and
absent teachers in the `tattendance` table.
6. **Fee Submission:**
- Records the fees submitted by students, including
details like name, class, roll number, month, fee amount,
and date.
7. **Salary Payment:**
- Records salary payment status for teachers, including
details like teacher name, payment month, and payment
confirmation.
8. **Display Records:**
- Displays student details for a particular class.
- Lists all teachers with their details.
9. **Password Protection:**
- Requires a password to access the system, ensuring
only authorized users can use it.
Technical Details:
1. **Programming Language:**
- Python 3.13
2. **Database:**
- MySQL is used to store and manage data. Tables
include:
- `student`
- `teacher`
- `cattendance` (student attendance)
- `tattendance` (teacher attendance)
- `fees`
- `salary`
3. **Libraries Used:**
- `mysql.connector`: For connecting to and executing
queries on the MySQL database.
4. **Input/Output:**
- Inputs are taken via the command line.
- Outputs include success/failure messages and
displayed records.
---
Code Structure:
1. **Modular Design:**
- The code is divided into functions for each specific
task, such as `addst()` for adding students or
`dispteacher()` for displaying teacher details.
2. **Menu-Driven Interface:**
- A central menu (`mainfun()`) guides users through
available tasks and ensures easy navigation.
3. **Error Prevention:**
- Uses parameterized SQL queries to prevent SQL
injection.
---
Advantages:
1. **Ease of Use:**
- Simple, text-based menu system allows non-technical
users to operate the system.
2. **Efficient Data Management:**
- Records are stored in a structured MySQL database,
ensuring quick and reliable access.
3. **Modular Code:**
- Functions are well-separated, making the code easier
to maintain and expand.
4. **Security:**
- Password authentication adds a layer of security.
5. **Customizable:**
- The system can be extended to include additional
features like generating reports or integrating with web-
based systems.
---
Limitations:
1. **Error Handling:**
- The current implementation lacks robust error handling
for database connection issues or invalid user inputs.
2. **Validation:**
- Input validation for data formats (e.g., phone numbers,
dates) is minimal.
3. **Scalability:**
- The command-line interface may not be ideal for
institutions with large datasets or multiple users.
4. **UI/UX:**
- The text-based interface may be less intuitive
compared to graphical user interfaces (GUIs).
---
Conclusion:
The Python-based Student Management System is a
functional and efficient tool for small to medium-sized
educational institutions. It simplifies record management,
enhances organization, and reduces manual errors. While
it is robust for basic operations, incorporating advanced
features, error handling, and a GUI would significantly
improve its usability and scalability.
Code:
import mysql.connector as a
# Establish connection
con = a.connect(host='localhost', user='root',
passwd='123456', database='school1')
def addst():
n = input("Student Name: ")
c = input("Class Name: ")
r = input("Roll no: ")
a = input("Address: ")
p = input("Phone No: ")
data = (n, c, r, a, p)
sql = 'INSERT INTO student (name, class, roll, address,
phone) VALUES (%s, %s, %s, %s, %s)'
cursor = con.cursor()
cursor.execute(sql, data)
con.commit()
print("Data Entered Successfully\n")
mainfun()
def remst():
c = input("Class Name: ")
r = input("Roll No: ")
data = (c, r)
sql = 'DELETE FROM student WHERE class = %s AND
roll = %s'
cursor = con.cursor()
cursor.execute(sql, data)
con.commit()
print("Data Deleted Successfully\n")
mainfun()
def addteacher():
n = input("Teacher Name: ")
p = input("Enter Post: ")
s = input("Enter Salary: ")
a = input("Enter Address: ")
ph = input("Enter Phone No: ")
ac = input("Enter Account No: ")
data = (n, p, s, a, ph, ac)
sql = 'INSERT INTO teacher (name, post, salary,
address, phone, account_no) VALUES (%s, %s, %s, %s,
%s, %s)'
cursor = con.cursor()
cursor.execute(sql, data)
con.commit()
print("Data Entered Successfully\n")
mainfun()
def removet():
n = input("Teacher Name: ")
ac = input("Account No: ")
data = (n, ac)
sql = 'DELETE FROM teacher WHERE name = %s
AND account_no = %s'
cursor = con.cursor()
cursor.execute(sql, data)
con.commit()
print("Data Deleted Successfully\n")
mainfun()
def abstudent():
d = input("Date (YYYY-MM-DD): ")
cl = input("Class Name: ")
ab = input("Name of Absent Students: ")
data = (d, cl, ab)
sql = 'INSERT INTO cattendance (date, class,
absent_students) VALUES (%s, %s, %s)'
cursor = con.cursor()
cursor.execute(sql, data)
con.commit()
print("Attendance Recorded\n")
mainfun()
def abteacher():
d = input("Date (YYYY-MM-DD): ")
ab = input("Name of Absent Teachers: ")
data = (d, ab)
sql = 'INSERT INTO tattendance (date,
absent_teachers) VALUES (%s, %s)'
cursor = con.cursor()
cursor.execute(sql, data)
con.commit()
print("Attendance Recorded\n")
mainfun()
def submitfee():
n = input("Student Name: ")
c = input("Class Name: ")
r = input("Roll No: ")
m = input("Month and Year (MM-YYYY): ")
f = input("Enter Fees: ")
d = input("Date (YYYY-MM-DD): ")
data = (n, c, r, m, f, d)
sql = 'INSERT INTO fees (name, class, roll,
month_year, fees, date) VALUES (%s, %s, %s, %s, %s,
%s)'
cursor = con.cursor()
cursor.execute(sql, data)
con.commit()
print("Fees Submitted\n")
mainfun()
def pays():
n = input("Teacher Name: ")
m = input("Month (MM-YYYY): ")
p = input("Payment Status (Yes/No): ")
data = (n, m, p)
sql = 'INSERT INTO salary (teacher_name, month,
payment_status) VALUES (%s, %s, %s)'
cursor = con.cursor()
cursor.execute(sql, data)
con.commit()
print("Salary Updated\n")
mainfun()
def dispclass():
cl = input("Class: ")
data = (cl,)
sql = 'SELECT * FROM student WHERE class = %s'
cursor = con.cursor()
cursor.execute(sql, data)
results = cursor.fetchall()
print("Student Details:")
for i in results:
print(f'Name: {i[0]}, Class: {i[1]}, Roll: {i[2]}, Address:
{i[3]}, Phone: {i[4]}')
print("\n")
mainfun()
def dispteacher():
sql = 'SELECT * FROM teacher'
cursor = con.cursor()
cursor.execute(sql)
results = cursor.fetchall()
print("Teacher Details:")
for i in results:
print(f'Name: {i[0]}, Post: {i[1]}, Salary: {i[2]}, Address:
{i[3]}, Phone: {i[4]}, Account No: {i[5]}')
print("\n")
mainfun()
def mainfun():
while True:
print("""
PITTS MODERN SCHOOL, GOMIA
1. ADD STUDENT 2. REMOVE STUDENT
3. ADD TEACHER 4. REMOVE TEACHER
5. CLASS ATTENDANCE 6. TEACHER
ATTENDANCE
7. SUBMIT FEES 8. PAY SALARY
9. DISPLAY CLASS 10. TEACHER LIST
0. EXIT
""")
ch = input("Enter Task No: ")
if ch == '1':
addst()
elif ch == '2':
remst()
elif ch == '3':
addteacher()
elif ch == '4':
removet()
elif ch == '5':
abstudent()
elif ch == '6':
abteacher()
elif ch == '7':
submitfee()
elif ch == '8':
pays()
elif ch == '9':
dispclass()
elif ch == '10':
dispteacher()
elif ch == '0':
print("Exiting...")
break
else:
print("Invalid Choice! Please Try Again.\n")
def pswd():
while True:
p = input("Enter Password: ")
if p == '123456':
mainfun()
break
else:
print("Wrong Password! Try Again.\n")
pswd()
Acknowledgment:
I would like to express my sincere gratitude to everyone who
contributed to the successful completion of this project on the
Student Management System.
hardwares:
PC/Laptop
Mobile phone
Software:
Python ( version 3.13 )
MYSOL
Python Connector Module
Index
Certificate
Acknowledgement
Objective
Feature and Functionality
Technical Details
Code Structure
Code
Output
Advantages
Limitations
Recommendations for
Improvement
Conclusion
Softwares and Hardwares Used
OUTPUT: