0% found this document useful (0 votes)
9 views4 pages

SPORT

Uploaded by

arcanedishidishi
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)
9 views4 pages

SPORT

Uploaded by

arcanedishidishi
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
You are on page 1/ 4

import mysql.

connector

conn = mysql.connector.connect(host='localhost', password='D7301@jqir#',


user='root',database='sports')

Cur=con.cursor()

def display():

query = ('SELECT*FROM students')

Cur.execute(query)

for (S_nos_no,sports, Number_Of_Students, Senior_Wing, Junior_Wing) in Cur:

print("------------------------------------------------------------------")

print("S_no :", S_nos_no)

print("Sport :", sport)

print("Number of students :", Number_Of_Students)

print("Students from senior wing :", Senior_Wing)

print("Students from junior wing :", Junior_Wing)

print("completed !!!!!")

def deletedata():

sno=input("Enter S_no of sport to be deleted:")

Qry=("""DELETE from students Where S_nos_no=%s""")

del_rec=(sno,)

Cur.execute(Qry,del_rec)

con.commit()

con.close()

print("Record(s) deleted successfully...")

def insertData():

S_nos_no=input("Enter s.no:")
name=input("enter sport:")

add=input("Enter Number of students:")

add2=input("Enter Number of students in Senior Wing:")

add3=input("""Enter Number of students in Junior Wing:

Note:Senior+Junior students must add up to totsl students""")

sql="INSERT INTO students VALUES(%s,%s,%s,%s,%s)"

values=(S_nos_no, name, add,add2,add3)

Cur.execute(sql.values)

Cur.execute("COMMIT")

con.commit()

print("Data saved successfully")

def search():

Sport=input("enter sport to be searched")

query=("SELECT * FROM students where name=%s")

rec_srch=(Sport,)

Cur.execute(query,rec_srch)

for (S_nos_no, sport, Number_Of_Students, Senior_Wing, Junior_Wing) in cur:

print("----------------------------------------------")

print("Sno:",S_nos_no)

print("sport:",sport)

print("Number of students:",Number_Of_Students)

print("Students in Senior Wing:",Senior_Wing)

print("Students in Junior Wing:",junior_Wing)

print("------------------------------------------")

print(Cur.rowcount, "Record(s) found")

con.commit()

def update():
sno=input("Enter sno of sport to be updated")

S_no=input("Enter S.no: ")

name=input("Enter name of faculty:")

experience_years=input("Enter years of experience:")

salary=input("enter salary")

Qry=("UPDATE faculty SET name=%s,experience_years=%s,salary=%s where S_nos_no=%s")

data=(name,experience_years,salary,sno)

Cur=execute(Qry,data)

con.commit()

print("Record(s) updated successfully")

def menubook():

while True:

print("\t\t Sports Management System \n")

print("================================================================")

print("1.Add record")

print("2.Display record")

print("3.Search record")

print("4.Delete record")

print("5.Update record")

print("6.Exit")

print("==================================================================")

choice=int(input("Enter choice from 1 to 5:"))

if choice==1:

insertData()

elif choice==2:

display()
elif choice==3:

search()

elif choice==4:

deletedata()

elif choice==5:

update()

elif choice==6:

return

else:

print("Wrong choice.Enter your choice again")

X=input("Enter any key to continue")

You might also like