Class XII Computer Science Project: School
Management System (Python + SQL)
This project demonstrates a simple School Management System using Python and SQL. It allows storing
and managing student data such as admission number, name, class, section and marks using a database.
Python is used to connect with the SQL database and perform operations like insert, search, update and
delete.
Objectives
Objectives of the Project:
1. To understand how Python connects with SQL databases.
2. To create and manage student records.
3. To perform database operations such as INSERT, SELECT, UPDATE and DELETE.
4. To build a basic management system used in schools.
SQL Table Creation
SQL Database Creation:
CREATE DATABASE school;
USE school;
CREATE TABLE students(
adm_no INT PRIMARY KEY,
name VARCHAR(50),
class VARCHAR(10),
section VARCHAR(5),
marks INT
);
Python Program
Python Program (Using MySQL Connectivity)
import [Link]
db = [Link](
host="localhost",
user="root",
password="1234",
database="school"
)
cursor = [Link]()
def add_student():
adm = int(input("Enter Admission No: "))
name = input("Enter Name: ")
cls = input("Enter Class: ")
sec = input("Enter Section: ")
marks = int(input("Enter Marks: "))
q = "INSERT INTO students VALUES(%s,%s,%s,%s,%s)"
[Link](q,(adm,name,cls,sec,marks))
[Link]()
print("Student Added Successfully")
def show_students():
[Link]("SELECT * FROM students")
data = [Link]()
for i in data:
print(i)
def search_student():
adm = int(input("Enter Admission No: "))
q = "SELECT * FROM students WHERE adm_no=%s"
[Link](q,(adm,))
data = [Link]()
print(data)
def delete_student():
adm = int(input("Enter Admission No: "))
q = "DELETE FROM students WHERE adm_no=%s"
[Link](q,(adm,))
[Link]()
print("Record Deleted")
while True:
print("[Link] Student")
print("[Link] Students")
print("[Link] Student")
print("[Link] Student")
print("[Link]")
ch = int(input("Enter Choice: "))
if ch==1:
add_student()
elif ch==2:
show_students()
elif ch==3:
search_student()
elif ch==4:
delete_student()
elif ch==5:
break
else:
print("Invalid Choice")
Conclusion
Conclusion: This project shows how Python can be used with SQL to manage school records. Such
systems help schools maintain student information digitally and make data retrieval faster and easier.