0% found this document useful (0 votes)
14 views20 pages

Project On Teacher Management Class 12 Computer Science

Uploaded by

sharmahuman296
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)
14 views20 pages

Project On Teacher Management Class 12 Computer Science

Uploaded by

sharmahuman296
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/ 20

MAHAVEER PUBLIC SCHOOL

COMPUTER SCIENCE
PROJECT ON
TEACHER MANAGEMENT SYSTEM
FOR
AISSCE 2024-2025 EXAMINATION
SUBMITTED BY

NAME Board Roll NO

1. KARTIK SHARMA _____________


2. AKSHAT GUPTA
Submitted To:
MS. SUMAN TANEJA
ACKNOWLEDGEMENT

I would like to express a deep sense of thanks and gratitude to my


Computer Science mentor Mrs. Suman Taneja for guiding me immensely
through the course of my project. Her constructive guidance and constant
motivation have been responsible for the successful completion of my
project
My sincere thanks to my parents for their motivation and support I must
thank my classmates for their timely help and support for Completion of
this project.

KARTIK SHARMA
XII-A
CERTIFICATE

This is to certify that Devanshi Trivedi, student of Class XII A has


successfully completed the Computer Science (083) Project on the topic
"Teacher Management System" under the guidance of Mrs. Suman Taneja
This project is absolutely genuine and does not indulge in plagiarism. The
references taken in making this project have been declared at the end of
this report

_______________ ____________
TEACHER’S SIGNATURE External Examiner
INDEX

1. ACKNOWLEDEGEMENT

2. CERTIFICATE

3. INTRODUCTION

4. Files imported in Project

5. TABLE CREATED IN MYSQL

6. CONTROL FLOW OF PROJECT

7. CODING

8. OUTPUT SCREENSHOT

9. BIBLIOGRAPHY
INTRODUCTION

The project will primarily deal with the records related to teacher i.e.
personal details, subjects taught, qualifications, and employment history
etc. Searching based on personal details, teacher Id, subjects and other
criteria. Entering the records, further changes and Deletion of any record
would also be possible in the program. The knowledge of tables in
MySQL, Functions, File handling, Exception Handling in python will be
used to create a fully functional program accepting an input processing
according to user demand and giving the proper output
Files imported in Project

import MySQL.Connector Package


To access the mysql database from python, we need a database driver.
Mysql connector/python is a standardized database driver provided by
mysql.
Menu(): This is the main menu from where we call the different functions
as per user choice.
1. addrecord(): This method is used to enter new record in the criminal
table.
2. modifyrecord(): - This method is used to change the existing record of
the criminal.
3. delrecord(): This method is used to delete the record as per criminal id
entered by the user
4. viewrecord(): - This method is used to retrieve all the records of the
criminal table
5. searchrecord(): - This method is used to find the particular criminal as
per name or criminal entered by the user.
Table created in MY SQL
Control Flow of Project
CODING

import mysql.connector

# Establish MySQL connection


conn = mysql.connector.connect(
host="localhost",
user="root",
password="root", # Replace with your MySQL root password
database="teacher_db"
)
cursor = conn.cursor()

# Function to add a new teacher record


def add_record():
try:
tid = int(input("Enter Teacher ID: "))
name = input("Enter Name: ")
age = int(input("Enter Age: "))
subject = input("Enter Subject: ")
salary = float(input("Enter Salary: "))
doj = input("Enter Date of Joining (YYYY-MM-DD): ")
query = "INSERT INTO teachers (t_id, name, age, subject, salary,
doj) VALUES (%s, %s, %s, %s, %s, %s)"
cursor.execute(query, (tid, name, age, subject, salary, doj))
conn.commit()
print("Record added successfully.")
except Exception as e:
print(f"Error adding record: {e}")

# Function to display all teacher records


def display_records():
try:
cursor.execute("SELECT * FROM teachers")
rows = cursor.fetchall()
print("\nTeacher Records:")
print("ID\tName\t\tAge\tSubject\t\tSalary\t\tDate of Joining")
for row in rows:

print(f{row[0]}\t{row[1]}\t\t{row[2]}\t{row[3]}\t\t{row[4]}\t\t{row[5]}
")
except Exception as e:
print(f"Error fetching records: {e}")

# Function to search for a teacher by ID


def search_by_id():
try:
tid = int(input("Enter Teacher ID to search: "))
query = "SELECT * FROM teachers WHERE t_id = %s"
cursor.execute(query, (tid,))
row = cursor.fetchone()
if row:
print(f"\\nRecord Found: ID: {row[0]}, Name: {row[1]}, Age:
{row[2]}, Subject: {row[3]}, Salary: {row[4]}, Date of Joining:
{row[5]}")
else:
print("No record found with the given ID.")
except Exception as e:
print(f"Error searching record: {e}")

# Function to update a teacher record


def update_record():
try:
teacher_id = int(input("Enter Teacher ID to update: "))
print("Enter new details (leave blank to keep current value):")
name = input("New Name: ")
age = input("New Age: ")
subject = input("New Subject: ")
salary = input("New Salary: ")

query = "SELECT * FROM teachers WHERE t_id = %s"


cursor.execute(query, (teacher_id,))
row = cursor.fetchone()
if not row:
print("No record found with the given ID.")
return

name = name if name else row[1]


age = int(age) if age else row[2]
subject = subject if subject else row[3]
salary = float(salary) if salary else row[4]
update_query = "UPDATE teachers SET name = %s, age = %s,
subject = %s, salary = %s WHERE t_id = %s"
cursor.execute(update_query, (name, age, subject, salary,
teacher_id))
conn.commit()
print("Record updated successfully.")
except Exception as e:
print(f"Error updating record: {e}")
# Function to delete a teacher record
def delete_record():
try:
teacher_id = int(input("Enter Teacher ID to delete: "))
query = "DELETE FROM teachers WHERE t_id = %s"
cursor.execute(query, (teacher_id,))
conn.commit()
print("Record deleted successfully.")
except Exception as e:
print(f"Error deleting record: {e}")
# Main menu
def main_menu():
while True:
print("\nTeacher Management System")
print("1. Add Record")
print("2. Display All Records")
print("3. Search by ID")
print("4. Update Record")
print("5. Delete Record")
print("6. Exit")
try:
choice = int(input("Enter your choice: "))
if choice == 1:
add_record()
elif choice == 2:
display_records()
elif choice == 3:
search_by_id()
elif choice == 4:
update_record()
elif choice == 5:
delete_record()
elif choice == 6:
print("Exiting...")
break
else:
print("Invalid choice. Please try again.")
except ValueError:
print("Invalid input. Please enter a number.")
# Run the program
if __name__ == "__main__":
main_menu()
# Close the connection
conn.close()
OUTPUT SCREENSHOTS

TO ADD RECORD
TO DISPLAY ALL RECORD

SEARCH BY ID
UPDATE RECORD

CURRENT VERSION

UPDATED VERSION
DELETE RECORD

EXISTING RECORD

DELETION PROCESS
NEW RECORD

EXIT
BIBLIOGRAPHY

For the sucessfull completetion of our project we have taken help from
the following:

1. Computer Science Teacher : Mrs. Suman Taneja


2. www.google.com
3. www.wikepedia.com
4. Computer Science class 12th Book

You might also like