0% found this document useful (0 votes)
46 views7 pages

Class 12 Computer Science Project

This document contains the code for a menu-driven program to manage records of ISRO (Indian Space Research Organization) missions stored in a SQL database. The program allows the user to search, view, add, update, delete records and obtain details about missions like purpose, director, vehicle used, launch site, budget, and view missions arranged by date. The code connects Python to MySQL, defines functions for each database operation, and uses a while loop to repeatedly display the menu until the user selects the "Exit" option.

Uploaded by

Shahid
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)
46 views7 pages

Class 12 Computer Science Project

This document contains the code for a menu-driven program to manage records of ISRO (Indian Space Research Organization) missions stored in a SQL database. The program allows the user to search, view, add, update, delete records and obtain details about missions like purpose, director, vehicle used, launch site, budget, and view missions arranged by date. The code connects Python to MySQL, defines functions for each database operation, and uses a while loop to repeatedly display the menu until the user selects the "Exit" option.

Uploaded by

Shahid
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/ 7

Complete coding of project:-

print(' '*20,'=======MJRP PUBLIC SCHOOL=======')


#project details
print(' '*20,'CLASS:-12th,A2')
print(' '*20,'PROJECT ON:- ISRO MISSIONS')
print(' '*20,'THIS PROJECT IS DONE BY:-')
#team members
print(' '*20,' :-TRIPURARI YADAV')
print(' '*20,' :-SHASHANK SINGH ')
print(' '*20,' :-PRATEEK KUSHWAHA')
print(' '*20,'UNDER GUIDANCE OF _SANJEEV SIR_')
#HOD of cs
ch='yes' #variable for while loop
#making loop for menu...

while ch=='yes':
print(' '*20,'______________LIST OF ISRO
MISSONS_____________')
print(' '*30,'===========MENU=============')
print(' '*20,'1=SEARCH RECORD BY MISSION
NAME')
print(' '*20,'2=SHOW ALL RECORDS')
print(' '*20,'3=ADD NEW RECORDS')
print(' '*20,'4=UPDATE RECORDS BY MISSION
NAME')
print(' '*20,'5=DELETE RECORDS BY MISSION
NAME')
print(' '*20,'6=SHOW THE PURPOSE OF
MISSION')
print(' '*20,'7=SHOW MISSION DIRECTOR BY
MISSION NAME')
print(' '*20,'8=SHOW VEHICLE BY MISSION
NAME')
print(' '*20,'9=SHOW LAUNCH SITE OF
MISSION')
print(' '*20,'10=SHOW THE BUDGET OF
MISSION')
print(' '*20,'11=SHOW MISSION NAME DATE
WISE')
print(' '*20,'12=EXIT...')
ch=int(input('ENTER YOUR CHOICE:-'))
#MAKING FUNCTIONS FOR QUERY EXECUTION
#query for search record...
def search_record():
msn=input('ENTER MISSION NAME FOR
DETAILS:-')
query="select * from isro where
MISSIONNAME=’{}'".format(msn)
mycur.execute(query)
data=mycur.fetchall()
for row in data:
print('MISSION DETAILS:--',row)
con.close()
#query for show all records...
def show_record():
query="select * from isro"
print('ALL RECORDS OF MISSION:--')
mycur.execute(query)
data=mycur.fetchall()
for row in data:
print(row)
con.close()

# query for add new record....


def add_record():
sno=int(input('ENTER SERIOL NUMBER:- '))
mission=input('ENTER MISSION NAME:- ')
date=input('ENTER LAUNCH DATE:- ')
status=input('ENTER STATUS OF THE
MISSION:- ')
typ=input('ENTER MISSION TYPE:- ')
vehicle=input('ENTER NAME OF VEHICLE
USED:- ')
purpose=input('ENTER PURPOSE OF
MISSION:-')
misdir=input('ENTER NAME MISSION
DIRECTOR:- ')
site=input('ENTER NAME OF LAUNCH SITE:-
')
budget=input('ENTER BUDGET OF MISSION:-
')
query="insert into isro
values({},'{}','{}','{}','{}','{}','{}','{}','{}
','{}')".format(sno,missi
on,date,status,typ,vehicle,purpose,misdir,site,b
udget)

mycur.execute(query)
con.commit()
con.close()
print('Your record added
successfully...')
#query for update records by mission name...
def update_record():
msn=input('ENTER MISSION NAME FOR UPDATE
RECORD:- ')
status=input('ENTER NEW MISSION STATUS:-
')
typ=input('ENTER NEW MISSION TYPE:- ')
purpose=input('ENTER NEW PURPOSE OF
MISSION:- ')
query="update isro set
STATUS='{}',TYPE='{}',PURPOSE='{}' where
MISSIONNAME='{}'".format(status,typ,purpose,msn)
mycur.execute(query)
con.commit()
con.close()
print('Your record updated
successfully')

#query for delete records by misson name...


def delete_record():
msn=input('ENTER MISSION NAME TO DELETE
RECORD:-')
query="delete from isro where
MISSIONNAME='{}'".format(msn)
mycur.execute(query)
con.close()
print('Your record deleted
successfully')
#QUERY FOR SHOW PURPOSE...
def show_purpose():
msn=input('ENTER MISSION NAME TO SHOW
PURPOSE:- ')
query="select PURPOSE from isro where
MISSIONNAME='{}'".format(msn)
print('PURPOSE OF YOUR MISSION:--')
mycur.execute(query)
data=mycur.fetchone()
print(data)
con.close()

#code for show mission director


def show_missiondir():
msn=input('ENTER MISSION NAME TO KNOW
MISSION DIRECTOR:-')
query="select MISSIONDIRECTOR from isro
where MISSIONNAME='{}'".format(msn)
mycur.execute(query)
data=mycur.fetchone()
print('NAME OF MISSION DIRECTOR
OF',msn,':--',data)
con.close()
#query FOR shOW VehICle
def show_vehicle():
msn=input('ENTER MISSION NAME TO KNOW
VEHICLE:- ')
query="select VEHICLE from isro where
MISSIONNAME='{}'".format(msn)

mycur.execute(query)
data=mycur.fetchone()
print('NAME OF VEHICLE USED
IN',msn,':--',data)
con.close()
#query For SHow budget of MIssion
def show_launchsite():
msn=input('ENTER MISSION NAME TO KNOW
LAUNCH SITE:-')
query="select LAUNCHSITE from isro where
MISSIONNAME='{}'".format(msn)
mycur.execute(query)
data=mycur.fetchone()
print('LAUNCH SITE OF',msn,':--',data)
con.close()
#query for arrange records
def arrange_datewise():
query="select MISSIONNAME,LAUNCHDATE
FROM isro GROUP BY LAUNCHDATE"
mycur.execute(query)
data=mycur.fetchall()
print(data)
con.close()
#query for show budget
def budget():
msn=input('ENTER MISSION NAME TO KNOW
THE BUDGET:- ')
query="select BUDGET from isro where
MISSIONNAME='{}'".format(msn)
mycur.execute(query)
data=mycur.fetchone()
print('BUDGET OF',msn,':--',data)
con.close()
#MaKinG COnnEctIon BeTweEN SQL AND PyThoN
import mysql.connector as myq
con=myq.connect(host='localhost',passwd='',user=
'root',database='space')
mycur=con.cursor()
#calling fxn TO RuN pRoGrAm...
if ch==1:
search_record()
elif ch==2:
show_record()

elif ch==3:
add_record()
ch=input('Do you want to show menu again
yes/no:-')
elif ch==4:
update_record()
ch=input('Do you want to show menu again
yes/no:-')
elif ch==5:
delete_record()
ch=input('Do you want to show menu again
yes/no:-')
elif ch==6:
show_purpose()
ch=input('Do you want to show menu again
yes/no:-')
elif ch==7:
show_missiondir()
ch=input('Do you want to show menu again
yes/no:-')
elif ch==8:
show_vehicle()
ch=input('Do you want to show menu again
yes/no:-')
elif ch==9:
show_launchsite()
ch=input('Do you want to show menu again
yes/no:-')
elif ch==10:
budget()
ch=input('Do you want to show menu again
yes/no:-')

elif ch==11:
arrange_datewise()
elif ch==12:
print('Exiting...')
break
#coding for ,if press other option...
else:
print('INVALID OPTION...\nPlease Enter
Valid Option...')

You might also like