SUNRISE ENGLISH PRIVATE SCHOOL
Computer Science
Investigatory Project
Student Information
Management System
(SIMS)
1|Page
STUDENT PARTICULARS
NAME : Harshith venkata sai sobhan
CLASS : XII - E
EXAM NUMBER :
ACADEMIC YEAR : 2024-2025
SCHOOL : Sunrise English Private
School
TEACHER : Mrs. Gayathri Ashok
kumar
SIGNATURE :
2|Page
3|Page
Index
S.N TOPIC PAGE
O. NO.
I Acknowledgeme 4
nt
II Aim 5
III Brief 6
explanation
IV User Defined 7-8
Function
V Source Code 9-14
VI Output 15-22
VII Conclusion 23
VII Advantages 24
VIII Disadvantages 25
VII Bibliography 26
4|Page
Acknowledgement
In the accomplishment of this project
successfully, many people have bestowed
upon me their blessings and their heart-felt
support, and so, I would like to thank all
those people who have been concerned
with project.
Firstly, I thank God for being able to
complete this project with success. Then I
would like to thank my principal, Mr. Thakur
Mulchandani, and my Computer Science
teacher, Mrs. Gayathri Ashok kumar, whose
valuable guidance that has been the ones
to help me complete this project.
I would also like to thank my parents and
friends who have helped me with their
valuable suggestions and guidance has
5|Page
been helpful in various phases of completion
of project.
6|Page
Aim
The Student Information Management System is a
comprehensive tool designed for efficient handling
and management of student records across primary
and secondary education categories. This system
simplifies tasks like adding, updating, deleting, and
searching student records while providing unique
identification through roll numbers categorized by
grade level. Built with Python.
MySQL, this system offers a clear, user-friendly
experience for tracking students' details,
attendance, and performance, making it an ideal
choice for streamlined student management in
educational institutions.
7|Page
Brief Description
This Student Information Management System is a
streamlined solution tailored to efficiently handle
various student-related tasks. With options to add,
update, delete, search, and organize records by
categories such as Primary and Secondary, it offers
a simple, user-friendly approach to manage student
information with unique roll number identification
for each category.
A key feature of this system is its attendance
tracking and detailed report generation, which
simplifies student monitoring for educators and
administrators. Powered by Python and MySQL, this
project serves as a reliable and interactive resource
for student data management, promoting organized
and accessible records within an academic setting.
8|Page
9|Page
User Defined
Function
[Link]
create_database_connection():
Establishes a connection to the MySQL database using
credentials provided in db_config. This function is critical
for querying and maintaining database connectivity
throughout the system.
execute_query(query, params=None):
Executes SQL commands (e.g., insert, delete, update)
on the database and commits changes. This function is
used to add or modify student records.
fetch_query(query, params=None):
Retrieves data from the database using SQL queries,
returning results for efficient student data retrieval.
[Link]
add_student():
Adds a new student record to the database. The user is
prompted to enter details such as roll number, category
(Primary or Secondary), name, age, and grade. Checks for
10 | P a g e
duplicate roll numbers within the same category and notifies
the user if a duplicate is found, preventing duplicate entries.
update_details():
Allows users to modify existing student records. The user
provides the roll number of the student they wish to
update, and then inputs new values for details like name,
age, category, and grade.
generate_reports():
Displays all student records and allows users to check
attendance for a specific date. Lists each student's details,
and if attendance records exist for the specified date,
shows the attendance status. If not, it displays "N/A."
mark_attendance():
Marks attendance for a student by their roll number and
category. The user specifies the date and attendance status
(Present or Absent). If an attendance record already exists
for that date, it updates the status; otherwise, it inserts a
new attendance entry.
[Link]
main():
The main menu function, where users can choose
options like adding, editing, deleting, displaying, or
searching for student records. It connects all functions,
enabling smooth user interaction with the system.
11 | P a g e
Source Code
import [Link]
db_config = {
'host': 'localhost',
'user': 'root',
'password': 'Abu@2007',
'database': 'sample_h'
}
def create_database_connection():
try:
connection = [Link](**db_config)
return connection
except [Link] as err:
print(f"Error: {err}")
return None
def execute_query(query, params=None):
connection = create_database_connection()
if connection:
try:
cursor = [Link]()
[Link](query, params)
[Link]()
except [Link] as err:
print(f"Error executing query: {err}")
finally:
[Link]()
[Link]()
def fetch_query(query, params=None):
connection = create_database_connection()
if connection:
try:
cursor = [Link]()
[Link](query, params)
result = [Link]()
12 | P a g e
return result
except [Link] as err:
print(f"Error fetching data: {err}")
return None
finally:
[Link]()
[Link]()
def search_student():
roll_number = input("Enter Roll Number to search: ")
category = input("Enter Category (Primary/Secondary):
").strip().capitalize()
student = fetch_query("SELECT * FROM students WHERE roll_number =
%s AND category = %s", (roll_number, category))
if student:
for s in student:
print(f"Roll Number: {s[0]}")
print(f"Name: {s[1]}")
print(f"Age: {s[2]}")
print(f"Category: {s[3]}")
print(f"Grade: {s[4]}")
print("----------------------------")
else:
print(f"No student found with Roll Number '{roll_number}' in
'{category}' category.")
def delete_student():
roll_number = input("Enter Roll Number of the student to delete: ")
category = input("Enter Category (Primary/Secondary): ").strip().lower()
existing_student = fetch_query("SELECT * FROM students WHERE
roll_number = %s AND category = %s", (roll_number,
[Link]()))
if not existing_student:
print(f"No student found with Roll Number '{roll_number}' in
'{[Link]()}' category.")
return
confirmation = input(f"Are you sure you want to delete the student with
Roll Number '{roll_number}' in '{[Link]()}' category?
13 | P a g e
(yes/no): ")
if [Link]() != 'yes':
print("Deletion cancelled.")
return
delete_attendance_query = "DELETE FROM attendance WHERE
roll_number = %s AND category = %s"
execute_query(delete_attendance_query, (roll_number,
[Link]()))
delete_student_query = "DELETE FROM students WHERE roll_number =
%s AND category = %s"
execute_query(delete_student_query, (roll_number, [Link]()))
print("Student deleted successfully!")
def add_student():
roll_number = input("Enter Roll Number: ")
category = input("Enter Category (Primary/Secondary):
").strip().capitalize()
existing_student = fetch_query("SELECT * FROM students WHERE
roll_number = %s AND category = %s", (roll_number, category))
if existing_student:
print(f"Error: Roll Number '{roll_number}' already exists in the
'{category}' category. Please enter a unique Roll Number within this
category.")
return
name = input("Enter Name: ")
age = input("Enter Age: ")
grade = input("Enter Grade: ")
query = "INSERT INTO students (roll_number, name, age, category,
grade) VALUES (%s, %s, %s, %s, %s)"
execute_query(query, (roll_number, name, age, category, grade))
print("Student added successfully!")
def update_details():
roll_number = input("Enter Roll Number of the student to update details:
")
14 | P a g e
category = input("Enter Category (Primary/Secondary):
").strip().capitalize()
students = fetch_query("SELECT * FROM students WHERE roll_number
= %s AND category = %s", (roll_number, category))
if students:
name = input("Enter New Name: ")
age = input("Enter New Age: ")
grade = input("Enter New Grade: ")
query = "UPDATE students SET name = %s, age = %s, grade = %s
WHERE roll_number = %s AND category = %s"
execute_query(query, (name, age, grade, roll_number, category))
print("Student details updated successfully!")
else:
print(f"Student with Roll Number '{roll_number}' in '{category}'
category not found.")
def generate_reports():
students = fetch_query("SELECT * FROM students")
if not students:
print("No students in the system.")
return
date = input("Enter the date for attendance report (YYYY-MM-DD): ")
print("\nStudent Reports:")
for student in students:
print(f"Roll Number: {student[0]}")
print(f"Name: {student[1]}")
print(f"Age: {student[2]}")
print(f"Category: {student[3]}")
print(f"Grade: {student[4]}")
attendance = fetch_query("SELECT status FROM attendance WHERE
roll_number = %s AND date = %s", (student[0], date))
if attendance:
print(f"Attendance: {attendance[0][0]}")
else:
print("Attendance: N/A")
print("----------------------------")
15 | P a g e
def mark_attendance():
roll_number = input("Enter Roll Number of the student to mark
attendance: ")
category = input("Enter Category (Primary/Secondary):
").strip().capitalize()
students = fetch_query("SELECT * FROM students WHERE roll_number
= %s AND category = %s", (roll_number, category))
if students:
date = input("Enter Attendance Date (YYYY-MM-DD): ")
status = input("Enter Attendance Status (Present/Absent):
").strip().capitalize()
attendance = fetch_query("SELECT * FROM attendance WHERE
roll_number = %s AND date = %s", (roll_number, date))
if attendance:
query = "UPDATE attendance SET status = %s WHERE roll_number =
%s AND date = %s"
execute_query(query, (status, roll_number, date))
print("Attendance status updated successfully!")
else:
query = "INSERT INTO attendance (roll_number, date, status)
VALUES (%s, %s, %s)"
execute_query(query, (roll_number, date, status))
print("Attendance marked successfully!")
else:
print(f"Student not found in the '{category}' category.")
def main():
print("Welcome to the Student Information Management System!")
while True:
print("\n1. Search Student\n2. Add Student\n3. Delete Student\n4.
Update Details\n5. Generate Reports\n6. Mark Attendance\n7. Exit")
choice = input("Enter your choice: ")
if choice == '1':
search_student()
elif choice == '2':
add_student()
elif choice == '3':
16 | P a g e
delete_student()
elif choice == '4':
update_details()
elif choice == '5':
generate_reports()
elif choice == '6':
mark_attendance()
elif choice == '7':
print("Exiting the Student Information Management System.
Goodbye!")
break
else:
print("Invalid choice. Please enter a valid option.")
if __name__ == '__main__':
main()
17 | P a g e
Output
Search a Student:
18 | P a g e
ADD a Student:
19 | P a g e
Delete a Student:
20 | P a g e
Update a Student:
21 | P a g e
Generate a Report:
22 | P a g e
Mark Attendance:
23 | P a g e
Exiting the SIMS:
24 | P a g e
Output From SQL :
25 | P a g e
Conclusion
26 | P a g e
"In conclusion, the Student Information
Management System offers a robust and
streamlined approach to managing essential
student information within an academic setting.
Through features like adding, deleting, updating,
and searching student records, along with
attendance tracking and report generation, this
system equips educators and administrators with a
reliable tool for organizing student data. By
leveraging Python and MySQL, the system ensures
a practical, user-friendly interface that simplifies
data handling, ultimately enhancing the
management of academic records. This project
exemplifies the practical application of technology
in education, supporting both efficient record-
keeping and a structured learning environment."
27 | P a g e
Advantages
1. Wide Applicability
2. User-friendly Data Structures
3. Versatile, Easy to Use and Fast to Develop
4. Presence of Third Party Modules
5. Easy to read and learn
6. Great productivity and speed
7. Extensive Support Libraries
28 | P a g e
Disadvantages
1. Large Memory Consumption
2. Not suitable for Mobile and Game
Development
3. Speed Limitations
4. Difficulty in Using Other Languages
5. Not Native to Mobile Environment
6. Underdeveloped Database Access Layer
29 | P a g e
Bibliography
[Link]
python_mysql_getstarted.asp
[Link]
connection-in-python/
[Link]
[Link]
preventing-duplicate-entries-in-sql
[Link]
[Link]
30 | P a g e