0% found this document useful (0 votes)
364 views8 pages

Fee Management

The document describes a student management system using Python and MySQL. It defines tables to store student and fee payment data, then provides functions to insert, view, update, and delete student and fee records through a menu-driven interface. The functions connect to a MySQL database called School and allow the user to add students, view student details, deposit fees, view fees for a student, and remove a student as needed.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
364 views8 pages

Fee Management

The document describes a student management system using Python and MySQL. It defines tables to store student and fee payment data, then provides functions to insert, view, update, and delete student and fee records through a menu-driven interface. The functions connect to a MySQL database called School and allow the user to add students, view student details, deposit fees, view fees for a student, and remove a student as needed.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

FEE - MANAGEMENT:

DBMS: MySQL
Host : localhost
User: root
Pass: root
DataBase: School
Table Structure:

SQL Commands to create both the tables:

Student table:
mysql> CREATE TABLE student (roll int(5) Primary key, name varchar(20)
NOT NULL, age int(2) NOT NULL, class varchar(3), City varchar(10));
Fee table:
mysql> CREATE TABLE fee (roll int(5) references Student(roll), FeeDeposit
int(6) NOT NULL, month varchar(10));
PYTHON CODE :

import os
import platform
import [Link]
import pandas as pd
mydb=[Link](host=”localhost”,\
user=”root”,\
password=”root”,\
database=”School”)
mycursor=[Link]()

def stuInsert():
L=[]
Roll=int(input(“Enter the roll number:”))
[Link](roll)
name=input(“Enter the Name:”)
[Link](name)
age=int(input(“Enter Age of Student:”))
[Link](age)
Class=input(“Enter the Class:”)
[Link](Class)
City=input(“Enter the City of the Student:”)
[Link](City)
stud=(L)
sql=”insert into student(roll,name,age,class,city)
values(%s,%s,%s,%s,%s)”
[Link](sql,stud)
[Link]()

def stuView():
print("Select the search criteria : ")
print("1. Roll")
print("2. Name")
print("3. Age")
print("4. City")
print("5. All")
ch=int(input("Enter the choice : "))
if ch==1:
s=int(input("Enter roll no : "))
rl=(s,)
sql="select * from student where roll=%s"
[Link](sql,rl)
elif ch==2:
s=input("Enter Name : ")
rl=(s,)
sql="select * from student where name=%s"
[Link](sql,rl)
elif ch==3:
s=int(input("Enter age : "))
rl=(s,)
sql="select * from student where age=%s"
[Link](sql,rl)
elif ch==4:
s=input("Enter City : ")
rl=(s,)
sql="select * from student where City=%s"
[Link](sql,rl)
elif ch==5:
sql="select * from student"
[Link](sql)
res=[Link]()
print("The Students details are as follows : ")
print("(ROll, Name, Age, Class, City)")
for x in res:
print(x)
def feeDeposit():
L=[]
roll=int(input("Enter the roll number : "))
[Link](roll)
feedeposit=int(input("Enter the Fee to be deposited : "))
[Link](feedeposit)
month=input("Enter month of fee : ")
[Link](month)
fee=(L)
sql="insert into fee (roll,feeDeposit,Month) values (%s,%s,%s)"
[Link](sql,fee)
[Link]()
def feeView():
print("Please enter the details to view the fee details :")
roll=int(input("Enter the roll number of the student whose fee is to
be viewed : "))
sql="Select [Link], [Link], [Link],
sum([Link]), [Link] from Student
INNER JOIN fee ON [Link]=[Link] and [Link] = %s"
rl=(roll,)
[Link](sql,rl)
res=[Link]()
for x in res:
print(x)

def removeStu():
roll=int(input("Enter the roll number of the student to be deleted :
"))
rl=(roll,)
sql="Delete from fee where roll=%s"
[Link](sql,rl)
sql="Delete from Student where roll=%s"
[Link](sql,rl)
[Link]()

def MenuSet(): #Function For The Student Management System


print("Enter 1 : To Add Student")
print("Enter 2 : To View Student ")
print("Enter 3 : To Deposit Fee ")
print("Enter 4 : To Remove Student")
print("Enter 5 : To View Fee of Any Student")

try: #Using Exceptions For Validation


userInput = int(input("Please Select An Above Option: "))

#Will Take Input From User


except ValueError:
exit("\nHy! That's Not A Number") #Error Message
else:
print("\n") #Print New Line
if(userInput == 1):
stuInsert()
elif (userInput==2):
stuView()
elif (userInput==3):
feeDeposit()
elif (userInput==4):
removeStu()
elif (userInput==5):
feeView()
else:
print("Enter correct choice. . . ")
MenuSet()
def runAgain():
runAgn = input("\nwant To Run Again Y/n: ")
while([Link]() == 'y'):
if([Link]() == "Windows"):
print([Link]('cls'))
else:
print([Link]('clear'))
MenuSet()
runAgn = input("\nwant To Run Again Y/n: ")
runAgain()

Output: (Adding Students)


(Viewing Students)

(Fee Depositing)
(Fee Viewing)

(Deleting Student)

After deletion the records are:

You might also like