0% found this document useful (0 votes)
28 views19 pages

STUDENT REGISTRATION SYSTEM (1)

Uploaded by

ramphool83
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)
28 views19 pages

STUDENT REGISTRATION SYSTEM (1)

Uploaded by

ramphool83
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/ 19

PM SHRI KENDRIYA VIDYALAYA

Artillery Centre Nashik Road Camp

Session : 2023-24

Computer Science Project


A Project Report On : Student
Registration System
Submitted By: AKHILESH KUMAR MEENA
Roll no:- 40 Class – 12B
Submitted to:-
Mrs. Pooja Agrawal
PGT (Computer Science)
Certificate
This is to certify that Akhilesh Kumar
Meena of class 12th B have successfully
completed their Computer Science
project on “Student Registration System”
under the guidance of Mrs. Pooja
Agarwal during the academic year 2024-
2025 as per the guidelines issued by
Central Board of Secondary Education
(CBSE).

Signature of Subject Teacher

Signature of External Examiner

Signature of Principal
Acknowledgements

I would like to thank our teacher, Mrs.


Pooja Agarwal who gave me this
opportunity to work on this project. I am
very grateful to her for her support and
guidance in completing this project. I
must also thank my parents and friends
for the immense support and help during
this project. Without their help,
completing this project would have been
very difficult.

Thank You
Table of Contents Page no
1. Cover Page 1
2. Certificate 2
3. Acknowledgements 3
4. Table Of Contents 4
5. PROJECT INTRODUCTION 5
6. Objective of the Project 7
7. Source code 9
8. Output 14
9. Data used 17

PROJECT ON STUDENT
REGISTRATION SYSTEM
Students are the most important entity of an institution.
It is, therefore, important to maintain error-free records
of all students. However, sometimes it become difficult to
maintain perfect records of all the students in one go. In
order to achieve flawless management of students details
and to keep data in an organized manner, “Students
Registration System” methodology is adopted.

This methodology serves the following purpose:


1)Enrolling students
2)Updating and displaying student details whenever required
3)Removing undesirable details and records
4)Generating a report of the marks obtained by students in
descending order

When admission is granted to a student in a


school, a detailed record if the student is
created which can be modified or deleted if
the students leaves the school.

This project (front end) has been developed


using python version 3.7.2. The
RDBMS(Relational Database Management
System) used in MySql.

The important modules used in the project


are as follows:
1) main_menu
2) create_table
3) display_struc
4) add_rec
5) update_rec
6) fetch_data
7) delete_rec
8) topper_list

The MySQL table used for storing students


details in this project is:
 student1
Name of the Database: school

About python-MySQL Connectivity

While designing real-life applications, certain


situations arise pertaining to storing some
important and necessary information by the user.
Usually, the data inputted by the user along with
the generated output are displayed but not
stored, since all the program execution takes
place inside the RAM, which is a temporary
memory, and as soon as we close the form, its
contents get erased.
When the application is executed the second
time, it requires a new set of inputs from the
user. This limitation can be overcome by sending
the output generated and saving the input
fetched from the user in a database created at
the back-end of the application. The input is
fetched from the user using Python Interface.

Database( The Back-end)

While working with an application, it is required


to save data permanently on some secondary
storage device, which is usually the hard disk, so
that data can be stored on it for further
reference, modification, deletion and retrieval. An
application usually stores a lot of data in the form
of a database which is not directly accessible to
the user. This database is used by the application
to give suitable response to the user. This
database is called Back-end Database.
WHY PYTHON

Python is a flexible, portable, easy to learn and


modifiable language. So, we are integrating
MySQL with Python interface for executing any
database applications.

CODE
#Student Registration System

def main_menu():
ch = 'y'
while ch == 'y':
print("***********STUDENT REGISTRATION SYSTEM*************")
print("1: To show databases")
print("2: To create a table")
print("3: To show tables present in the database")
print("4: To display structure of the table")
print("5: To add a record in the table")
print("6: To update a record in the table")
print("7: To delete a record from the table")
print("8: To display all the records from the table")
print("9: To sort the data in descending order of total")
print("10: To quit")
choice = int(input("Enter your choice"))
if choice == 1:
show_database()
elif choice == 2:
create_table()
elif choice == 3:
showtables()
elif choice == 4:
display_struc()
elif choice == 5:
add_rec()
elif choice == 6:
update_rec()
elif choice == 7:
delete_rec()
elif choice == 8:
fetch_data()
elif choice == 9:
topper_list()
elif choice == 10:
print("Exiting")
break
else:
print("Wrong input")
ch = input("Do you want to continue")

def show_database():
import mysql.connector
try:
db = mysql.connector.connect(host = "localhost", user = "root", password = "")
cursor = db.cursor()
cursor.execute("show databases")
for x in cursor:
print(x)
except:
print("Error in connection")

def create_table():
import mysql.connector
try:
db = mysql.connector.connect(host = "localhost", user = "root", password =
"", database = "school")
cursor = db.cursor()
cursor.execute("create table student1(rollno int primary key,\ name
varchar(20), stream varchar(10), total\ int, grade varchar(3), Class int)")
print("Table created")
except:
print("Error in connection")

def showtables():
import mysql.connector
try:
db = mysql.connector.connect(host = "localhost", user = "root", password = "",
database = "school")
cursor = db.cursor()
cursor.execute("show tables")
for x in cursor:
print(x)
except:
print("Error in connection")

def display_struc():
import mysql.connector
try:
db = mysql.connector.connect(host = "localhost", user = "root", password = "",
database = "school")
cursor = db.cursor()
cursor.execute("desc student1")
for x in cursor:
print(x)
except:
print("Error in connection")

def add_rec():
import mysql.connector
try:
db = mysql.connector.connect(host = "localhost", user = "root", password = "",
database = "school")
cursor = db.cursor()
rno = int(input("Enter roll number"))
nm = input("Enter name")
st = input("Enter stream")
tot = int(input("Enter total"))
gr = input("Enter grade")
C = int(input ("Enter class"))
sql_query = "insert into student1 values(%s,%s,%s,%s,%s,%s)"
val = (rno,nm,st,tot,gr,C)
cursor.execute(sql_query,val)
db.commit()
print("Record added")
except:
db.rollback()
print("Error, Record not added")

def update_rec():
import mysql.connector
try:
db = mysql.connector.connect(host = "localhost", user = "root", password = "",
database = "school")
cursor = db.cursor()
rno = int(input("Enter rollno"))
tot = int(input("Enter total"))
sql_query = "Update student1 set total = %s where rollno = %s"
val = (tot,rno)
cursor.execute(sql_query,val)
print(cursor.rowcount, "record updated")
db.commit()
except:
db.rollback()
print("Record not updated")

def delete_rec():
import mysql.connector
try:
db = mysql.connector.connect(host = "localhost", user = "root", password = "",
database = "school")
cursor = db.cursor()
rno = int(input("Enter rollno"))
sql_query = "delete from student1 where rollno = %s"
cursor.execute(sql_query,(rno,))
print(cursor.rowcount, "record deleted")
db.commit()
except:
db.rollback()
print("Record not deleted")
def fetch_data():
import mysql.connector
try:
db = mysql.connector.connect(host = "localhost", user = "root", password = "",
database = "school")
cursor = db.cursor()
cursor.execute("SELECT * FROM student1")
records = cursor.fetchall()
for x in records:
print(x[0],x[1],x[2],x[3],x[4],x[5])
except:
print("Error, unable to fetch data")

def topper_list():
import mysql.connector
try:
db = mysql.connector.connect(host = "localhost", user = "root", password = "",
database = "school")
cursor = db.cursor()
cursor.execute("select * from student1 order by total desc")
records = cursor.fetchall()
for x in records:
print(x[0],x[1],x[2],x[3],x[4],x[5])
except:
print("Error, unable to sort")

main_menu()
once the above code is written and all modules are created,
upon execution, it will show the following output window:
In the above project, we have used formatting (%sign) with
print()statement, which we will discuss now.
FORMATTING DATA

Formatting Data with print() statement


Usually we align strings to the left and numbers to the
right. Python supports formatting values into strings.

SYMBOL DESCRIPTION
1) %c character
2) %s string
3) %d signed decimal
integer
4) %i integer
5) %u unsigned
decimal int
6) %o octal integer
7) %f floating
number
8) %e exponential
notation
9) %E exponential
notation
10)%x hexadecimal
lowercase

11)%X hexadecimal
uppercase

NOTE : The % operator is sometimes called


string interpolation since it interpolates literal text
and converted values.

You might also like