PDF

Download as pdf or txt
Download as pdf or txt
You are on page 1of 32

GURU NANAK PUBLIC SCHOOL

LAJPAT NAGAR, KANPUR

SUBMITTED TO: SUBMITTED BY:


Mr. Nizam sir Alakh Gautam
Computer Science Class-12
CERTIFICATE:

This is to certify that Alakh Gautam of Class XII, A


has prepared the report on the Project entitled
“Railway Reservation on System”. The report is the
result of his efforts & endeavours which has been
prepared under the guidance of Mr. Nizam (PGT
Computer Science), during the academic year 2024-
2025 as per the guidelines laid down by the Central
Board of Secondary Educa on. The report is found
worthy of acceptance as final project for the subject
Computer Science (081) of Class XII.

______________ _______________
Internal Examiner External Examiner
ACKNOWLEDGEMENT:
Apart from the efforts of me, the success of any project depends
largely on the encouragement and guidelines of many others. I
take this opportunity to express my gratitude to the people who
have been instrumental in the successful completion of this
project. I express deep sense of gratitude to almighty God for
giving me strength for the successful completion on of the
project. I express my heartfelt gratitude to my parents for
constant encouragement while carrying out this project. I
gratefully acknowledge the contributed on of the individuals
who contributed in bringing this project up to this level, who
continues to look after me despite my flaws, I express my deep
sense of gratitude to the luminary The Principal, Guru Nanak
Public School (MRS. Neeta Pandey) who has been continuously
motivating and extending their helping hand to us. I express my
sincere thanks to the academician The vice Principal, Guru Nanak
Public School (Mr. Sudhir Kumar Gupta), for constant
encouragement and the guidance provided during school. My
sincere thanks to MR. Nizam, Master In-charge, A guide, Mentor
all the above a friend, who critically reviewed my project and
helped in solving each and every problem, occurred during
implementation of the project. The guidance and support
received from all the members who contributed and who are
contributing to this project, was vital for the success of the
project. I am grateful for their constant support and help.
INDEx:

Sr. No. DESCRIPTION PAGE NO.

1 Certificate 2

2 Acknowledgement 3

3 Introduction to project 5

4 Objective of the project 6

5 Scope of the project 6

6 The Existing system 6

7 Proposed system 7

8 Python and SQL 7-12

9 Source Code 13-23

10 Sample Outputs 24-29

11 Conclusion 30

12 Hardware & Software requirement 31

13 Bibliography 32
STUDENTS MANAGEMENT SYSTEM

INTRODUCTION:
Student Management System project is written in Python
language and SQL is used for database connection. This is a
simple console-based system which is very easy to understand
and use. Talking about the system, it contains all the basic
functions which include insert new student details, view
student’s details that already exists, update or we can modify
student details also deletion function is there to delete the
student details that no more exist. It is too easy to use; he/she
can check the total student records easily. This project is
multifield project, so that it can be modified for various
purposes. The main object of this system is to provide a secure
system.
OBJECTIVES OF THE PROJECT:
The objective of this project is to
 Let the students apply the programming knowledge into a
real- world situation/problem and exposed the students how
programming skills helps in developing a good software.
 Write programs utilizing modern software tools.
 Apply object-oriented programming principles effectively
when developing small to medium sized projects.
 Implementing strong security measure to protect sensitive
financial data.
SCOPE OF THE PROJECT
User friendly interface
 Fast access to database
 Less error
 More Storage Capacity Search facility
 Look and Feel Environment
ExISTING SYSTEM:
In the current system we need to keep a number of records
related to the student and want to enter the details of the
student and the marks manually. In this system only the
teacher or the school authority views the mark of the student
and they want to enter the details of the student. This is time
consuming and has much cost.
PROPOSED SYSTEM:
Aim of this system is used to control and coordinate a
student’s data, information, their, name, admission number,
add new student or delete a student’s information. One has to
use the data management software. Software has been an
ascent in atomization various organizations. Many software
products working is now in markets, which have helped in
making the organizations work easier and efficiently. Data
management initially had to maintain a lot of ledgers and a lot
of paper work has to be done but now software product on
this organization has made their work faster and easier. Now
only this software has to be loaded on the computer and work
can be done.
This prevents a lot of time and money. The work becomes
fully automated and any information regarding the
organization can be obtained by clicking the button. Moreover,
now it’s an age of computers of and automating such an
organization gives the better look. Admin will have the full
authority to add features and disable it as per their
requirements.
WHAT IS PYTHON
Python is an interpreted high-level general-purpose
programming language. Its design philosophy emphasizes
code readability with its use of significant indentation. Its
language constructs as well as its object-oriented approach
aim to help programmers write clear, logical code for small
and large-scale projects.
Python is dynamically-typed and garbage-collected. It
supports multiple programming paradigms, including
structured (particularly, procedural), object-oriented and
functional programming. It is often described as a "batteries
included" language due to its comprehensive standard library.
FEATURES IN PYTHON
There are many features in Python, some of which are
discussed below
1. Easy to code:
Python is a high-level programming language. Python is very
easy to learn the language as compared to other languages
like C, C#, JavaScript, Java, etc. It is very easy to code in python
language and anybody can learn python basics in a few hours
or days. It is also a developer-friendly language.
2. Free and Open Source:
Python language is freely available at the official website and
you can download it easily. Since it is open-source, this means
that source code is also available to the public. So, you can
download it as, use it as well as share it.
3. Object-Oriented Language:
One of the key features of python is Object-Oriented
programming. Python supports object-oriented language and
concepts of classes, objects encapsulation, etc.
4. GUI Programming Support:
Graphical User interfaces can be made using a module such as
PyQt5, PyQt4, python, or Tk in python. PyQt5 is the most
popular option for creating graphical apps with Python.
5. High-Level Language:
Python is a high-level language. When we write programs in
python, we do not need to remember the system architecture,
nor do we need to manage the memory.
6. Extensible feature:
Python is an Extensible language. We can write us some
Python code into C or C++ language and also, we can compile
that code in C/C++ language.
7. Python is Portable language:
Python language is also a portable language. For example, if
we have python code for windows and if we want to run this
code on other platforms such as Linux, Unix, and Mac then we
do not need to change it, we can run this code on any platform.
8. Python is Integrated language:
Python is also an integrated language because we can easily
integrated python with other languages like C, C++, etc.
9. Interpreted Language:
Python is an Interpreted Language because Python code is
executed line by line at a time. like other languages C, C++,
Java, etc. there is no need to compile python code this makes
it easier to debug our code. The source code of python is
converted into an immediate form called bytecode.
10. Large Standard Library:
Python has a large standard library which provides a rich set
of module and functions so you do not have to write your own
code for every single thing. There are many libraries present
in python for such as regular expressions, unit-testing, web
browsers, etc.
11. Dynamically Typed Language:
Python is a dynamically-typed language. That means the type
(for example- int, double, long, etc.) for a variable is decided
at run time not in advance because of this feature we don’t
need to specify the type of variable.
STRUCTURED QUERY LANGUAGE (SQL)
WHAT IS SQL
SQL stands for Structured Query Language. It is used for
storing and managing data in relational database
management system (RDMS). It is a standard language for
Relational Database System. SQL is used to communicate with
a database. According to ANSI (American National Standards
Institute), it is the standard language for relational database
management systems. SQL statements are used to perform
tasks such as update data on a database, or retrieve data from
a database. Some common relational database management
systems that use SQL are: Oracle, Sybase, Microsoft SQL
Server, Access, Ingres, etc. However, the standard SQL
commands such as "Select", "Insert", "Update", "Delete",
"Create", and "Drop" can be used to accomplish almost
everything that one needs to do with a database. There are
the following advantages of SQL:
 High speed. Using the SQL queries, the user can quickly and
efficiently retrieve a large number of records from a database.
 No coding needed. ...
 Well defined standards. ...
 Portability. ...
 Interactive language. ...
 Multiple data view.
The features of SQL:
 SQL is an ANSI and ISO standard computer language for
creating and manipulating databases.
 SQL allows the user to create, update, delete, and retrieve
data from a database. SQL is very simple and easy to learn.
 SQL works with database programs like DB2, Oracle, MS
Access, Sybase, MS SQL Server, etc.
 SQL Queries can be used to retrieve large amounts of records
from a database quickly and efficiently.

PYTHON MYSQL CONNECTIVITY


What are the steps for connecting MySQL with Python?
How to connect MySQL database in Python
1. Install MySQL connector module. Use the pip command to
install MySQL connector Python. ...
2. Import MySQL connector module. ...
3. Use the connect () method. ...
4. Use the cursor () method. ...
5. Use the execute () method. ...
6. Extract result using fetch all () ...
7. Close cursor and connection objects
SOURCE CODE:

import mysql.connector
import random
from tabulate import tabulate
from mysql.connector import Error
import os
def database():
random_value = random.randint(33, 100)
con=mysql.connector.connect(host="localhost",user="r
oot",passwd="")
cur=con.cursor()
cur.execute("create database if not exists School")
con.commit()
cur.execute("use School")
cur.execute("create table if not exists
students_Data(stuId int primary key
auto_increment,studF_Name varchar(20), studL_Name
varchar(20),class int,sec varchar(4),marks float)")
con.commit()
cur.close()
con.close()
def Insert_Data():
try:
con = mysql.connector.connect(
host="localhost",
user="root",
passwd="",
database='School'
)
cur = con.cursor()

# Get user input


F_Name = input("Enter First Name Student: ")
L_Name = input("Enter Last Name Student: ")
cl = int(input("Enter Student class: "))
sec = input("Enter Student Section: ")
marks = float(input("Enter Student marks: "))

# Insert new record


insert_query = """
INSERT INTO students_Data
(studF_Name, studL_Name, class, sec, marks)
VALUES (%s, %s, %s, %s, %s)
"""
cur.execute(insert_query, (F_Name, L_Name, cl, sec,
marks))

# Reorder serial numbers


cur.execute("SET @row_number = 0")
cur.execute("""
UPDATE students_Data
SET stuId = (@row_number := @row_number + 1)
ORDER BY stuId
""")

con.commit()
print("Record inserted successfully and serial numbers
reordered")

except Exception as ex:


print(f"Error: {str(ex)}")

finally:
if 'con' in locals() and con.is_connected():
cur.close()
con.close()
def Show_Data():
try:
connection = mysql.connector.connect(
host='localhost',
user='root',
password='',
database='School'
)

if connection.is_connected():
print("Connected to MySQL database")
cursor = connection.cursor()

query = "SELECT * FROM students_Data"


cursor.execute(query)
results = cursor.fetchall()

# Define headers
headers = ['ID', 'F_Name', 'L_Name', 'Class', 'Section',
'Marks']
# Print table using tabulate
print("\n" + tabulate(results,
headers=headers,
tablefmt='pretty',
stralign='left'))

except mysql.connector.Error as err:


print(f"Error: {err}")

def Search_Data():
try:
con=mysql.connector.connect(host="localhost",user="r
oot",passwd="",database='School')
cur=con.cursor()
a=input("Enter Student First Name:")
b=input("Enter Student Last Name:")
cur.execute("select * from students_Data where
studF_Name='{}' and studL_Name='{}'".format(a, b))
data=cur.fetchall()
headers = ['ID', 'F_Name', 'L_Name', 'Class', 'Section',
'Marks']
print("\n" + tabulate(data,
headers=headers,
tablefmt='pretty',
stralign='left'))
con.close()
except Exception as ex:
print(str(ex))

def Update_Data():
try:
con = mysql.connector.connect(host="localhost",
user="root", passwd="", db="School")
cur = con.cursor()
cur.execute("select * from students_Data")
orginal_data = cur.fetchall()
print("Original Data:")
print(tabulate(orginal_data, headers=["ID", "F_Name",
"L_Name", "Class", "Section", "Marks"], tablefmt="pretty",
stralign="left"))
print("\n" + tabulate(orginal_data, headers=["ID",
"F_Name", "L_Name", "Class", "Section", "Marks"],
tablefmt="pretty", stralign="left"))
con.autocommit = True
def selct_data():
print("Select the column to update:")
print("1. First Name")
print("2. Last Name")
print("3. Class")
print("4. Section")
print("5. Marks")
choice = int(input("Enter your choice: "))
if choice == 1:
column = "studF_Name"
elif choice == 2:
column = "studL_Name"
elif choice == 3:
column = "class"
elif choice == 4:
column = "section"
elif choice == 5:
column = "marks"
else:
print(" Invalid choice")
return column
column = selct_data()
new_value = input("Enter the new value: ")
stuId = input("Enter the student ID to update: ")
update_query = f"UPDATE students_Data SET {column}
= %s WHERE stuId = %s"
cur.execute(update_query, (new_value, stuId))
con.commit()
print("Data updated successfully")
cur.execute("SELECT * FROM students_Data")
updated_data= cur.fetchall()
print("Updated Data:")
print(tabulate(updated_data, headers=["ID",
"F_Name", "L_Name", "Class", "Section", "Marks"],
tablefmt="pretty", stralign="left"))
con.close()
except Exception as ex:
print(str(ex))
def Delete_Data():
try:
con = mysql.connector.connect(host="localhost",
user="root", passwd="", db="School")
cur = con.cursor()
cur.execute("SELECT * FROM students_Data")
data=cur.fetchall()
hearders = ['ID', 'F_Name', 'L_Name', 'Class', 'Section',
'Marks']
print("\n" + tabulate(data, headers=hearders,
tablefmt="pretty", stralign="left"))
con.autocommit = True
stuId = input("Enter the student ID to delete: ")
data_to_delete = cur.fetchone()
print("Data to delete:")
print(tabulate(data_to_delete, headers=hearders,
tablefmt="pretty", stralign="left"))
print(tabulate(data_to_delete, headers=["ID",
"F_Name", "L_Name", "Class", "Section", "Marks"],
tablefmt="pretty", stralign="left"))
con.autocommit = True
delete_query = "DELETE FROM students_Data WHERE
stuId = %s"
cur. execute(delete_query, (stuId,))
con.commit()
print("Data deleted successfully")
cur.execute("SELECT * FROM students_Data")
remaining_data = cur.fetchall()
print("Remaining Data:")
data1=cur.fetchall()
print("\n" + tabulate(remaining_data,
headers=hearders, tablefmt="pretty", stralign="left"))
print(tabulate(remaining_data, headers=["ID",
"F_Name", "L_Name", "Class", "Section", "Marks"],
tablefmt="pretty", stralign="left"))
con.close()
except Exception as ex:
print(str(ex))

database()
while True:
#os.system('cls')
print("1-----Insert Record")
print("2-----Show Record")
print("3-----Update Record")
print("4-----Search Record")
print("5-----Delete Record")
print("6-----Exit")
op=int(input("Enter your option:"))
if op==1:
Insert_Data()
elif op==2:
Show_Data()
elif op==3:
Update_Data()
elif op==5:
Delete_Data()
elif op==4:
Search_Data()
elif op==6:
break
else:
break
OUTPUT:

Output1: Welcome Interface of Student Management


System.
Output2: Insert the Record.
Output 3: Show The Record.
Output 4: Update a Record.
Output 5: Search the Record.
Output 6: Delete a Record.
CONCLUSION:
This Student Management System Project in Python is a way
to enhance and broaden our competencies and logic ideas
which is essential in training the Python programming
language. In this Simple Student Management System, the
user can also look for a student’s call so one can recognize
whether the student’s record exists in the gadget or not. This
project covers only the basic features required.
HARDWARE AND SOFTWARE REQUIRED

HARDWARE

1. Laptop
2. Mobile Phone
3. Computer
4. Pen Drive

SOFTWARE
1. MySQL
2. Visual Studio Coder
3. Python Language
BIBLOGRAPHY

BOOKS
 Sumita Arora-Computer Science with Python

WEBSITES

• https://www.wikipedia.org/
• https://www.youtube.com/
• Class 12 Project Railway Reservation | PDF | Python
(Programming Language) | Computer Programming
(scribd.com)

You might also like