Ip Python Project On School MGMT
Ip Python Project On School MGMT
Ip Python Project On School MGMT
Table:Student
Table: Emp
Table:Fee
Table:Exam
Python Code:
import os import
platform import
mysql.connector
#import pandas as pd
#from pandas import DataFrame
def selection():
db = mysql.connector.connect(user='root', password='tiger', host='localhost',database='mysql') cursor =
db.cursor() print('-----------------------------------\nWELCOME TO SCHOOL MANAGEMENT SYSTEM\n---------------------
--------------') print("1.STUDENT MANAGEMENT") print("2.EMPLOYEE MANAGEMENT") print("3.FEE
MANAGEMENT") print("4.EXAM MANAGEMENT")
def insert1():
sname=input("Enter Student Name : ")
admno=int(input("Enter Admission No : "))
dob=input("Enter Date of Birth(yyyy-mm-dd): ")
cls=input("Enter class for admission: ") cty=input("Enter
City : ")
db = mysql.connector.connect(user='root', password='tiger', host='localhost',database='mysql')
cursor = db.cursor()
sql="INSERT INTO student(sname,admno,dob,cls,cty) VALUES ( '%s' ,'%d','%s','%s','%s')"%(sname,admno,dob,cls,cty)
try:
cursor.execute(sql)
db.commit() except:
db.rollback()
db.close()
#insert()
def display1():
try:
db = mysql.connector.connect(user='root', password='tiger', host='localhost',database='mysql')
cursor = db.cursor() sql = "SELECT * FROM student" cursor.execute(sql) results =
cursor.fetchall() for c in results: sname = c[0] admno= c[1] dob=c[2]
cls=c[3] cty=c[4]
print ("(sname=%s,admno=%d,dob=%s,cls=%s,cty=%s)" % (sname,admno,dob,cls,cty))
except:
print ("Error: unable to fetch data")
db.close() def update1(): try:
db = mysql.connector.connect(user='root', password='tiger', host='localhost',database='mysql')
cursor = db.cursor() sql = "SELECT * FROM student" cursor.execute(sql) results =
cursor.fetchall()
def update4():
try:
db = mysql.connector.connect(user='root', password='tiger', host='localhost',database='mysql')
cursor = db.cursor() sql = "SELECT * FROM exam" cursor.execute(sql) results =
cursor.fetchall()
OUTPUT:
INSERT DETAILS
UPDATE DETAILS
DELETE DETAILS
By:
Shivkamal Singh (PGT CS)
KV Sehore