CS Project Updated1
CS Project Updated1
PROJECT FILE
ON
Student Management
➢Synopsis
➢Certificate
➢Acknowledgement
➢Modules
➢Coding
➢Outputs
➢Bibliography
SYNOPSIS
Topic:
Computer Science Project
Project Name: Student Management Software
Features:
1. Keep the records of your daily money transactions.
2. SQL based features
- Data can be easily accessible.
- Data is secure.
3. Get the data in csv file format that will take less storage and
can be imported in excel spreadsheet and etc.
Hardware/Software Requirements:
1. Python
2. MySQL
Future Scope:
1. It will become cloud-based software which will improve its
efficiency.
2. To make the software accessible from anywhere.
Limitations:
1. Only few Queries available.
Date: 3/01/2022
Roll No.: 07
__________________ __________________
Acknowledgement
I would like to express a deep sense of thanks &
gratitude to my computer science teacher Sonal Sharma
for guiding me immensely through the course of the
project.
My sincere thanks to our Principal Rajeev Singhal for
his co-ordination in extending every possible support
for the completion of the project.
MODULES USED
1. MySQL Connector
2. OS
MySQL Code
show databases;
use mysql;
show tables;
create table stu2
(roll int,
name varchar(255),
marks int,
result varchar(255));
select * from stu2;
Python code
import mysql.connector
import os
def enter_record():
con=mysql.connector.connect (host="localhost", user="root”, password="1234")
cur=con.cursor ()
cur.execute("use mysql")
ans='y'
while ans=='y':
roll=int(input("Enter roll no. "))
name=input("Enter name: ")
marks=int(input("Enter marks of student : "))
if marks<33:
result="fail"
else:
result="pass"
query="insert into stu2 values('{0}','{1}',{2},'{3}')".format(roll,name,marks,result)
cur.execute(query)
con.commit()
ans=input("Want to add more record press y or for exit press any key: ")
print(" Record is saved " )
def show_all():
con=mysql.connector.connect(host="localhost", user="root", password="1234")
cur=con.cursor()
cur.execute("use mysql")
print("RollNo","\t","Name","\t","Marks","\t","Result")
cur.execute("Select * from stu2")
for x in cur:
u,v,w,y=x
print(u,"\t",v,"\t",w,"\t",y)
def search_roll():
con=mysql.connector.connect(host="localhost", user="root", password="1234")
cur=con.cursor()
cur.execute("use mysql")
roll=int(input("Enter roll no. whose record is to be searched: "))
query="select * from stu2 where roll=({0})".format(roll)
cur.execute(query)
mydata=cur.fetchall()
nrec=cur.rowcount
if nrec!=0:
print("No. of records of given roll no. is :" ,nrec, " and record is given below:")
print("RollNo","\t","Name","\t","Marks","\t","Result")
for x in mydata:
u,v,w,y=x
print(u,"\t",v,"\t",w,"\t",y)
else:
print("No such Student with given roll no.")
def search_name():
con=mysql.connector.connect(host="localhost", user="root", password="1234")
cur=con.cursor()
cur.execute("use mysql")
name=input("Enter name whose record is to be searched: ")
query="select * from stu2 where name='%s' "%(name,)
cur.execute(query)
mydata=cur.fetchall()
nrec=cur.rowcount
if nrec!=0:
print("No. of records of given Name is :" ,nrec, " and record given below:")
print("RollNo","\t","Name","\t","Marks","\t","Result")
cur.execute("Select * from stu2")
for x in mydata:
u,v,w,y=x
print(u,"\t",v,"\t",w,"\t",y)
else:
print("No such Student with given Name")
def modify_roll():
con=mysql.connector.connect(host="localhost", user="root", password="1234")
cur=con.cursor()
cur.execute("use mysql")
cur.execute("Select * from stu2")
mydata=cur.fetchall()
roll=int(input("Enter roll no. whose value to be update: "))
for i in mydata:
if roll==int(i[0]) :
roll1=int(input("Enter New roll no. "))
name1=input("Enter New name: ")
marks1=int(input("Enter New marks of student : "))
if marks1<33:
result1="fail"
else:
result1="pass"
query="update stu2 set roll={},name='{}',marks={},result='{}' where
roll={}".format(roll1,name1,marks1,result1,roll)
c=0
for i in mydata:
if roll==int(i[0]) :
cur.execute(query)
con.commit()
c=c+1
if c!=0:
print(c, "Record updated successfully")
else:
print("No Record not found of given roll no.")
def delete_roll():
con=mysql.connector.connect(host="localhost", user="root", password="1234")
cur=con.cursor()
cur.execute("use mysql")
cur.execute("Select * from stu2")
mydata=cur.fetchall()
roll=int(input("Enter roll no. whose record is to be deleted: "))
query="delete from stu2 where roll={}".format(roll)
v=0
for i in mydata:
if roll==int(i[0]) :
print(i,end=" ")
cur.execute(query)
con.commit()
v=v+1
if v!=0:
print(v, "record found and deleted " )
else:
print("No Record not found of given roll no.")
while True:
os.system("cls")
print(40*"=")
print(""" Main Menu
---------
1. Add record
2. display all records
3. search by rollno
4. search by name
5. Modify by rollno
6. delete by rollno
7. exit
""")
print(40*"=")
ch=int(input("Enter your choice "))
print(40*"=")
if(ch==1):
enter_record()
elif(ch==2):
show_all()
elif(ch==3):
search_roll()
elif(ch==4):
search_name()
elif(ch==5):
modify_roll()
elif(ch==6):
delete_roll()
elif(ch==7):
print("End")
break
else:
print("Invalid choice")
OUTPUTS
www.cbseportal.com
BIBLIOGRAPHY