0% found this document useful (0 votes)
21 views50 pages

Sample Project

Uploaded by

arunabhsanyal144
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views50 pages

Sample Project

Uploaded by

arunabhsanyal144
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 50

School management

system
SESSION : 2022-23

Submitted By: - Guided By:-


Name: ABHYUDAY PATEL MRS. RUMA GOSWAMI
Class : XII PGT (COMPUTER SCIENCE)
Board roll no -
1

This is to certify that the project entitled


SCHOOL MANAGEMENT SYSTEM is a
bonafide work done by ABHYUDAY PATEL of
class XII Session 2022-23 in the partial
fulfillment of CBSE’s AISSCE Examinations and
has been carried out under my direct
supervision and guidance.

………………………
Mrs. Ruma Goswami

PGT Computer Science

………………………..
Signature of External
2

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 my heartfelt gratitude to my parents for constant


encouragement while carrying out this project.

I express my deep sense of gratitude to our Principal, Dr.


Subhosree Sarkar who has been continuously motivating
and provided moral support during completion of project.

My sincere thanks to my teacher Mrs. Ruma Goswami, a


guide, mentor and 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.
3

S.NO DESCRIPTION PAGE.NO

01. INTRODUCTION OF PROJECT 04

02. OBJECTIVES OF PROJECT 05

03. IMPLEMENTATION OF PROJECT 07

04. PROBLEM DEFINITION 08

05. SYSTEM ANALYSIS 09

06. LANGUAGE USED 12

07. HARDWARE AND SOFTWARE REQUIREMENTS 17

08. DATA STRUCTURE 18

09. SOURCE CODE 21

10. OUTPUT 37

11. BIBLIOGRAPHY 48
4

The project titled “SCHOOL MANAGEMENT SYSTEM” is a


School Management software for monitoring records and
storing data in school. This software mainly focuses on
basic operations like adding records for students and
teachers, updating new information, retrieving information
about them and maintaining the records for performance
of students.

The system is reduced as much as possible to avoid errors


while entering the data. It also provides error message while
entering invalid data. It leads to error free, reliable and fast
management system.

The system has following advantages :

Fast access to database


Less Error
User friendly
Search facility
5

The project titled “SCHOOL MANAGEMENT SYSTEM” is a


system for supervising and managing the data in the school.
It is the most proficient and easy to use system for
managing all the processes involved in a School in the most
effective ways. The purpose of the project is to build a
system to reduce the manual work for managing the
Member, Books, Address, Records, etc.

The Objectives of School Management


System :

To build a system that can receive input and


generate output automatically in an easy way and
in short time.

To build a monitoring system that is able to


monitor and manage all operations efficiently.
6

To give an opportunity to teachers and office staffs


to reduce mistakes that always happen during
manual method.

To enter and preserve details of the various


student records and attendance monitoring.

To build digital school Infrastructure.

To fulfil needs that cannot be achieved by


manual system.

To provide greater accountability and


transparency in data operations.

By using School Management System, the


operation of issuing and managing inventories is
paperless. This system provides a user-friendly
data entry to make the input easier to understand
and use.
7

In the digital world where education sector is working


towards making its space automated, why should schools
still operate the old school way? Managing hundreds of
books daily & keeping their track record and also records of
students is not an easy task. School Management System can
transform the manually operating databases into
automated ones seamlessly making it efficient & effective
at the same time.

School Management System are useful


for such operations :

School libraries

Admission and fees

collection

Attendance

monitoring
8

Before a program is written for solving a problem, it is


important to define the problem clearly. For most software
Projects, system analysts approach to system users tocollect
user requirements and define the problem that a system aims
to solve. Problem definition is one of the most crucial steps in
any project. Without defining a problem, developers do not
know what to build, customers do notknow what to expect
and there is no way to validate that the built system satisfies
the requirement.

School Management System can be used to maintain the


records of books in library , in admission process , in
attendence monitoring, keeping records and all necessary
requirements for the school to manage day-to- day
operations. Achieving this objective is difficult using manual
system as the information is scattered, can be redundant and
collecting relevant information may be very time consuming.
All these problems are solved using thisproject. The system is
reduced as much as possible to avoid errors while entering
the data.
9

System Analysis is a process of gathering and interpreting


facts, diagnosing problems and the information about the
school Management System to recommend improvements on
the system. It is a problem-solving activity that requires
intensive communication between the system users and
system developers. System Analysis or study is an important
phase of any system development process. System Analysis
is concerned with becoming aware of the problem, identifying
the relevant and decisional variables, analysing and
synthesizing the various factors and determining an optimal
or at least a satisfactory solution or program of action.

SYSTEM
REQUIREMENTS
SPECIFICATIONS
A software requirements specification (SRS) is a
detailed description of a software system to be
developed with its functional and non-functional
requirements.
10

Functional
Requirements
• New Student Registration

➢ System must be able to verify information


➢ System must be able to delete information if
information is wrong.

• Register New Student

➢ System must be able to verify information


➢ System must be able to enter new information into
table.
➢ System must be able to not allow two student
record having same admission number.

• Search Record

➢ System must be able to search the database based


on select search type.
➢ System must be able to filter records based on
admission number.
➢ System must be able to show the filtered record
11
12

1) PYTHON

2) My SQL

INTRODUCTION TO
PYTHON
Python is an open source, object oriented, high-level
programming language developed by Guido van Rossum in
1991 at the National Research Institute for Mathematics,
Netherlands. It is presently owned by Python Software
Foundation (PSF).

Python is a general-purpose programming language that can


be used effectively to build any kind of program that does not
require direct access to the computer’s hardware.

FEATURES OF PYTHON
❖ Easy to Learn and
Use
❖ Interpreted and
cross platform
Language
13

INTRODUCTION
TO MySQL
WHAT IS A DATABASE ?
A database is a separate application that stores a collection
of data. Each database has one or more distinct APIs for
creating, accessing, managing, searching and replicating
the data it holds. Other kinds of data stores can also be
used, such as files on the file system or large hash tables
In memory but data fetching and writing would not be so fast and
easy with those type of systems .Nowadays, we use relational
database management systems (RDBMS) to store and manage huge
volume of data. This is called relational database because all the
data is stored into different tables and relations are established
using primary keys or other keys known as Foreign Keys.

A Relational Database Management System (RDBMS) is a


software that :

✓ Enables you to implement a database with tables,


columns and indexes.

✓ Interprets an SQL query and combines information


from various tables.
14
15

RDBMS TERMINOLOGY
❖ Database − A database is a collection of tables, with
related data.
❖ Table − A table is a matrix with data. A table in a
database looks like a simple spreadsheet.

❖ Column – One column (data element) contains data of one


and the same kind, for example the column postcode.

❖ Row – A row (= tuple, entry or record) is a group of related


data, for example the data of one subscription.

❖ Redundancy – Storing data twice, redundantly to make


the system faster.

❖ Primary Key – A primary key is unique. A key value cannot


occur twice in one table. With a key, you can only find one
row.

❖ Foreign Key − A foreign key is the linking pin between


two tables.

❖ Compound Key – A compound key (composite key) is a


key that consists of multiple columns, because one column
is not sufficiently unique.

❖ Index – An index in a database resembles an index at the


back of a book.

❖ Referential Integrity – Referential Integrity makes sure


that a foreign key value always points to an existing row.
16
17
18

HARDWARE REQUIREMENTS
Intel Atom® processor or
Processor Intel® Core™ i3 processor or
more
Memory Capacity 1 GB or More
RAM 128 MB or more
Hard Disk Capacity 4GB or More
Monitor CRT or LCD monitor
Keyboard Normal or Multimedia
Mouse Compatible Mouse
For printing hard-copy
Printer
reports

SOFTWARE REQUIREMENTS
Operating System Windows 7,8,10

Python IDLE 3.7 or higher

MySQL 5.7 or 8.0

MS-Word 2007 or higher


19

DBMS : MySQL
Host : localhost
User : abhyuday
Passwd : 12345
Database : school

TABLE STRUCTURE
1) Table Admission -

2) Table Fees -
20

3)Table Student-

CODE TO CREATE TABLE


import mysql.connector
mydb = mysql.connector.connect(host = "localhost",\
user = "abhyuday",\
passwd = "12345",\
database = "school")
cursor = mydb.cursor()

# To create a table 'book' in MySQL using Python


qry1 = "CREATE TABLE IF NOT EXISTS book(Book_ID int
Primary Key, Book_Name varchar(100),Author
varchar(100), Price float, No_Copies int, Rem_Copies
int);"
21

cursor.execute(qry1)
print("Book table created successfully !!!! \n")

# To create a table 'member' in MySQL using Python


qry2 = "CREATE TABLE IF NOT EXISTS member(Member_ID
int Primary Key, Member_Name varchar(40),Member_Add
varchar(70), Contact_No char(10));"
cursor.execute(qry2)
print("Member table created successfully !!!! \n")

# To create a table 'issue' in MySQL using Python


qry3 = "CREATE TABLE IF NOT EXISTS issue(Issue_ID int
Primary Key, Issue_Date date,Member_ID int, Book_ID
int, Issued_Books int);"
cursor.execute(qry3)
print("Issue table created successfully !!!! \n")

# TO create a table 'returns' in MySQL using Python


qry4 = "CREATE TABLE IF NOT EXISTS returns(Return_ID
int Primary Key, Return_Date date,Member_ID int,
Book_ID int, Returned_Books int);"
cursor.execute(qry4)
print("Return table created successfully !!!! \n")
22

===============================================

# PYTHON PROGRAM FILE : main.py


import book
import members
import transactions
from tabulate import tabulate
import mysql.connector
mydb = mysql.connector.connect(host="localhost",\
user="root",\
passwd="root",\
database="library")
cursor = mydb.cursor()

while True:
try:
print("="*80,"\n")
print("\t********** LIBRARY MANAGEMENT SYSTEM
**********","\n")
print("="*80)
print("\n")
print("\t1. BOOK DETAILS MENU DRIVE")
print("\t2. MEMBER DETAILS MENU DRIVE")
print("\t3. ISSUE AND RETURN BOOK MENU DRIVE")
print("\t4. EXIT")
print("\n")
print("-"*40)
choice = int(input("Enter your choice (1-4) : "))
print("-"*40)
print("\n")
if choice == 1:
while True:
print("*"*40)
print("====== BOOK DETAILS MENU DRIVE
======")
print("*"*40)
print("\t1. ADD BOOK DETAILS")
print("\t2. DISPLAY BOOK DETAILS")
print("\t3. UPDATE BOOK DETAILS")
print("\t4. SEARCH A BOOK")
print("\t5. DELETE A BOOK")
print("\t6. DELETE ALL BOOK DETAILS")
print("\t7. BACK TO MAIN MENU")
print("\n")
23

print("-"*40)
ch = int(input("Enter your choice (1-7) :
"))
print("-"*40)
print("\n")
if ch == 1:
book.add_book()
elif ch == 2:
book.display_book()
elif ch == 3:
book.update_book()
elif ch == 4:
book.search_book()
elif ch == 5:
book.delete_book()
elif ch == 6:
book.alldelete_book()
elif ch == 7:
break
else:
print("ERROR : Invalid Entry !!!!
\nTry Again")
print("\n")
elif choice == 2:
while True:
print("*"*40)
print("====== MEMBER DETAILS MENU DRIVE
======")
print("*"*40)
print("\t1. ADD MEMBER DETAILS")
print("\t2. DISPLAY MEMBER DETAILS")
print("\t3. UPDATE MEMBER DETAILS")
print("\t4. SEARCH A MEMBER")
print("\t5. DELETE A MEMBER")
print("\t6. DELETE ALL MEMBER DETAILS")
print("\t7. BACK TO MAIN MENU")
print("\n")
print("-"*40)
ch = int(input("Enter your choice (1-7) :
"))
print("-"*40)
print("\n")
if ch == 1:
members.add_member()
elif ch == 2:
members.display_member()
elif ch == 3:
members.update_member()
elif ch == 4:
members.search_member()
elif ch == 5:
members.delete_member()
elif ch == 6:
24

members.alldelete_member()
elif ch == 7:
break
else:
print("ERROR : Invalid Entry !!!!
\nTry Again")
print("\n")
elif choice == 3:
while True:
print("*"*44)
print("====== ISSUE AND RETURN MENU DRIVE
======")
print("*"*44)
print("\t1. DISPLAY ALL BOOK DETAILS")
print("\t2. DISPLAY ALL MEMBER DETAILS")
print("\t3. ISSUE BOOK")
print("\t4. RETURN BOOK")
print("\t5. DISPLAY ALL ISSUE DETAILS")
print("\t6. DISPLAY ALL RETURN DETAILS")
print("\t7. BACK TO MAIN MENU")
print("\n")
print("-"*40)
ch = int(input("Enter your choice (1-7) :
"))
print("-"*40)
print("\n")
if ch == 1:
transactions.book_details()
elif ch == 2:
transactions.member_details()
elif ch == 3:
transactions.book_issue()
elif ch == 4:
transactions.book_return()
elif ch == 5:
transactions.issue_details()
elif ch == 6:
transactions.return_details()
elif ch == 7:
break
else:
print("ERROR : Invalid Entry !!!!
\nTry Again")
print("\n")
elif choice == 4:
break
else:
print("ERROR : Invalid Entry !!!!! \nTry Again")
print("\n")
except:
print("Something went wrong !!!!!")
print("Try Again. ... ")
print("\n")
25

===============================================

# PYTHON MODULE : book.py


from tabulate import tabulate
import mysql.connector
mydb = mysql.connector.connect(host="localhost",\
user="root",\
passwd="root",\
database="library")
cursor = mydb.cursor()

# to add book details in the library


def add_book():
try:
ans='y'
while ans.lower()=='y':
Book_ID = input("Enter the Book ID : ")
Book_Name = input("Enter Book name : ")
Author = input("Enter Author name : ")
Price = input("Enter price of Book : ")
No_Copies = input("Enter no of copies : ")
qry = "INSERT INTO book
VALUES({},'{}','{}',{},{},{});".format(Book_ID
,Book_Name,Author,Price,No_Copies,No_Copies)
cursor.execute(qry)
mydb.commit()
print("\n")
print("Book added successfully !!!!")
print("\n")
ans = input("Do you want to add more books ? (Y/N)
: ")
print("\n")
except:
print("\n")
print("Something went wrong !!!!! \nPlease Try
Again. ... ")
print("\n")

# to update the Book name on the basis of Book ID


def b_name():
try:
x = int(input("Enter Book ID for updation to be done :
"))
qry = "SELECT * FROM book WHERE Book_ID =
{};".format(x)
26

cursor.execute(qry)
r = cursor.fetchone()
if r:
y = input("Enter new Book name : ")
qry = "UPDATE book SET Book_Name = '{}' WHERE
Book_ID = {};".format(y,x)
cursor.execute(qry)
mydb.commit()
print("\n")
print("Updated Book name successfully. .... ")
else:
print("\n")
print("ERROR : Incorrect Book ID !!!!!")
print("\n")
except:
print("\n")
print("Something went wrong !!!!! \nPlease Try
Again .... ")
print("\n")

# to update Author name on the basis of Book ID


def a_name():
try:
x = int(input("Enter Book ID for updation to be done :
"))
qry = "SELECT * FROM book WHERE Book_ID =
{};".format(x)
cursor.execute(qry)
r = cursor.fetchone()
if r:
y = input("Enter new Author name : ")
qry = "UPDATE book SET Author = '{}' WHERE Book_ID
= {};".format(y,x)
cursor.execute(qry)
mydb.commit()
print("\n")
print("Updated Author name successfully. .... ")
else:
print("\n")
print("ERROR : Incorrect Book ID !!!!!")
print("\n")
except:
print("\n")
print("Something went wrong !!!!! \nPlease Try
Again. ... ")
print("\n")

# to update price of book on the basis of Book ID


def p_change():
try:
27

x = int(input("Enter Book ID for updation to be done :


"))
qry = "SELECT * FROM book WHERE Book_ID =
{};".format(x)
cursor.execute(qry)
r = cursor.fetchone()
if r:
y = float(input("Enter new price for book : "))
qry = "UPDATE book SET Price = {} WHERE Book_ID =
{};".format(y,x)
cursor.execute(qry)
mydb.commit()
print("\n")
print("Updated price of book successfully. .... ")
else:
print("\n")
print("ERROR : Incorrect Book ID !!!!!")
print("\n")
except:
print("\n")
print("Something went wrong !!!! \nPlease Try
Again. .... ")
print("\n")

# to update the quantity of books on the basis of Book ID


def q_change():
try:
x = int(input("Enter Book ID for updation to be done :
"))
qry = "SELECT * FROM book WHERE Book_ID =
{};".format(x)
cursor.execute(qry)
r = cursor.fetchone()
if r:
y = float(input("Enter new copies for book : "))
qry = "UPDATE book SET No_Copies = {}, Rem_Copies =
{} WHERE Book_ID = {};".format(y,y,x)
cursor.execute(qry)
mydb.commit()
print("\n")
print("Updated quantities of books
successfully. .... ")
else:
print("\n")
print("ERROR : Incorrect Book ID !!!!!")
print("\n")
except:
print("\n")
print("Something went wrong !!!!! \nPlease Try
Again. ... ")
print("\n")
28

# to update the data of the book


def update_book():
while True:
try:
print("_"*69,"\n")
print("\t*****MENU FOR MODIFICATION OF DETAILS OF
BOOKS*****")
print("_"*69)
print("\n")
print("1. Book Name")
print("2. Author Name")
print("3. Price of the book")
print("4. Book Quantity")
print("5. Return to Book Details Menu")
print("\n")
print("-"*50)
ch1 = int(input("Enter your choice which have to
modified (1-4) : "))
print("-"*50)
print("\n")
if ch1 == 1:
b_name()
elif ch1 == 2:
a_name()
elif ch1 == 3:
p_change()
elif ch1 == 4:
q_change()
elif ch1 == 5:
break
else:
print("ERROR : Invalid Entry !!!!! \nTry
Again")
print("\n")
except:
print("\n")
print("Something went wrong !!!!! \nPlease Try
Again. .... ")
print("\n")

# to display the details of the books in library


def display_book():
try:
qry = "SELECT * FROM book"
cursor.execute(qry)
print("\t\t\t\t******BOOKS******")
print(tabulate(cursor,headers=["Book_ID","Book_Name",
"Author","Price","No_Copies","Rem_Copies"],table
fmt = "psql"))
print("\n")
except:
29

print("Something went wrong")

# to search the record of book


def search_book():
while True:
print("_"*68,"\n")
print("\t******MENU FOR SEARCHING BOOK DETAILS******")
print("_"*68)
print("\n")
print("1. Book ID")
print("2. Book Name")
print("3. Author Name")
print("4. Return to Book Details Menu")
print("\n")
print("-"*45)
ch = int(input("Enter your choice for Book details (1-
4) : "))
print("-"*45)
print("\n")
if ch == 1:
x = input("Enter the Book ID for searching book
details : ")
a = "SELECT * FROM book WHERE Book_ID =
'{}'".format(x)
cursor.execute(a)
r = cursor.fetchall()
if r == []:
print("\n")
print("ERROR : Invalid Book ID entered !!!!!")
print("Nothing to display \nTry Again")
print("\n")
else:
print("\n")
print(r)
print("\n")
elif ch == 2:
x = input("Enter the Book name for searching book
details : ")
a = "SELECT * FROM book WHERE Book_Name =
'{}'".format(x)
cursor.execute(a)
r = cursor.fetchall()
if r == []:
print("\n")
print("ERROR : Invalid Book name entered
!!!!!")
print("Nothing to display \nTry Again")
print("\n")
else:
print("\n")
print(r)
30

print("\n")
elif ch == 3:
x = input("Enter the Author name for searching book
details : ")
a = "SELECT * FROM book WHERE Author =
'{}'".format(x)
cursor.execute(a)
r = cursor.fetchall()
if r == []:
print("\n")
print("ERROR : Invalid Author name entered
!!!!!")
print("Nothing to display \nTry Again")
print("\n")
else:
print("\n")
print(r)
print("\n")
elif ch == 4:
break
else :
print("ERROR : Invalid Entry !!!! \nTry Again")
print("\n")

# to delete the record of book


def delete_book():
try:
ans='y'
while ans.lower()=='y':
x = int(input("Enter Book ID for removing the
member details : "))
qry = "SELECT * FROM book WHERE Book_ID =
{};".format(x)
cursor.execute(qry)
r = cursor.fetchone()
if r:
qry = "DELETE FROM book WHERE Book_ID =
{};".format(x)
cursor.execute(qry)
mydb.commit()
print("\n")
print("Removed Book details
successfully. .... ")
print("\n")
ans=input("Do you want to delete more record ?
(Y/N) : ")
print("\n")
else:
print("\n")
print("ERROR : Invalid Book ID entered !!!!!")
print("\n")
except:
31

print("\n")
print("Something went wrong !!!!! \nPlease Try
Again. ... ")
print("\n")

# to delete all records of book


def alldelete_book():
qry = "DELETE FROM book ;"
cursor.execute(qry)
mydb.commit()
print("\n")
print("Removed all Book details successfully. .... ")
print("\n")

===============================================

# PYTHON MODULE : members.py


from tabulate import tabulate
import mysql.connector
mydb = mysql.connector.connect(host="localhost",\
user="root",\
passwd="root",\
database="library")
cursor = mydb.cursor()

# to member details in the library


def add_member():
try:
ans = 'y'
while ans.lower()== 'y':
Member_ID = input("Enter the Member ID : ")
Member_Name = input("Enter Member name : ")
Member_Add = input("Enter member's address : ")
Contact_No = input("Enter contact number of member
: ")
qry = "INSERT INTO member
VALUES({},'{}','{}','{}');".format(Member_ID,M
ember_Name,Member_Add,Contact_No)
cursor.execute(qry)
mydb.commit()
print("\n")
print("Member added successfully !!!!")
print("\n")
ans = input("Do you want to add more members ?
(Y/N) : ")
print("\n")
except:
print("\n")
32

print("Something went wrong !!!!! \nPlease Try


Again. ... ")
print("\n")

# to update the member's address on the basis of Member ID


def update_member():
try:
x = int(input("Enter Member ID for updation to be done
: "))
qry = "SELECT * FROM member WHERE Member_ID =
{};".format(x)
cursor.execute(qry)
r = cursor.fetchone()
if r:
y = input("Enter new address : ")
qry = "UPDATE member SET Member_Add = '{}' WHERE
Member_ID = {};".format(y,x)
cursor.execute(qry)
mydb.commit()
print("\n")
print("Updated member's address
successfully. .... ")
print("\n")
else:
print("\n")
print("ERROR : Incorrect Book ID !!!!!")
print("\n")
except:
print("\n")
print("Something went wrong !!!!! \nPlease Try
Again. ... ")
print("\n")

# to display the details of the member's in library


def display_member():
try:
qry = "SELECT * FROM member"
cursor.execute(qry)
print("\t\t******MEMBERS******")
print(tabulate(cursor,headers=["Member_ID","Member_Na
me","Member_Add","Contact_No"],tablefmt =
"psql"))
print("\n")
except:
print("Something went wrong")

# to search the record of member


def search_member():
try:
33

x = input("Enter the Member ID for searching member


details : ")
a = "SELECT * FROM member WHERE Member_ID =
{}".format(x)
cursor.execute(a)
r = cursor.fetchall()
if r == []:
print("\n")
print("ERROR : Invalid member ID entered !!!!!")
print("Nothing to display")
print("\n")
else:
print("\n")
print(r)
print("\n")
except:
print("\n")
print("Something went wrong !!!!! \nPlease Try
Again. .... ")
print("\n")

# to delete the record of book


def delete_member():
try:
ans='y'
while ans.lower()=='y':
x = int(input("Enter Member ID for removing the
member details : "))
qry = "SELECT * FROM member WHERE Member_ID =
{};".format(x)
cursor.execute(qry)
r = cursor.fetchone()
if r:
qry = "DELETE FROM member WHERE Member_ID =
{};".format(x)
cursor.execute(qry)
mydb.commit()
print("\n")
print("Removed member details
successfully. .... ")
print("\n")
ans = input("Do you want to delete more record
? (Y/N) : ")
print("\n")
else:
print("\n")
print("ERROR : Invalid member ID entered
!!!!!")
print("\n")
except:
34

print("\n")
print("Something went wrong !!!!! \nPlease Try
Again. ... ")
print("\n")

# to delete all records of book


def alldelete_member():
qry = "DELETE FROM member ;"
cursor.execute(qry)
mydb.commit()
print("\n")
print("Removed all Member details successfully. .... ")
print("\n")

===============================================

# PYTHON MODILE : transactions.py

from tabulate import tabulate


import mysql.connector
mydb = mysql.connector.connect(host="localhost", user="root",
passwd="root",database="library")
cursor = mydb.cursor()

# to issue book from library


def book_issue():
try:
q = "SELECT MAX(Issue_ID) FROM issue;"
cursor.execute(q)
r = cursor.fetchone() [0]
if r:
Issue_ID = r+1
else:
Issue_ID = 1
x = int(input("Enter Member ID : "))
q1 = "SELECT * FROM member WHERE Member_ID =
{};".format(x)
cursor.execute(q1)
r = cursor.fetchone()
if r:
z = int(input("Enter Book ID : "))
q2 = "SELECT Book_ID, Rem_Copies FROM book WHERE
Book_ID = {};".format(z)
35

cursor.execute(q2)
r = cursor.fetchone()
if r:
if r[1] > 0:
Issue_Date = input("Enter Issue date : ")
Issued_Books = int(input("Enter no of books
to be issued : "))
remcopies = r[1]-Issued_Books
q3 = "INSERT INTO issue
VALUES({},'{}',{},{},{});".format(Issu
e_ID,Issue_Date,x,z,Issued_Books)
cursor.execute(q3)
q4 = "UPDATE book SET Rem_Copies = {} WHERE
Book_ID = {};".format(remcopies,z)
cursor.execute(q4)
mydb.commit()
print("\n")
print("Book Issued Successfully. .. ")
print("\n")
else:
print("Book is not Available")
else:
print("\n")
print("ERROR : Incorrect Book ID !!!!!")
print("\n")
else:
print("\n")
print("ERROR : Incorrect Member ID !!!!!!")
print("\n")
except:
print("\n")
print("Something went wrong !!!!!")
print("\n")

# to return book to library


def book_return():
try:
q = "SELECT MAX(Return_ID) FROM returns;"
cursor.execute(q)
r = cursor.fetchone() [0]
if r:
Return_ID = r+1
else:
Return_ID = 1
x = int(input("Enter Member ID : "))
q1 = "SELECT * FROM member WHERE Member_ID =
{};".format(x)
cursor.execute(q1)
r = cursor.fetchone()
if r:
z = int(input("Enter Book ID : "))
36

q2 = "SELECT Book_ID, Rem_Copies FROM book WHERE


Book_ID = {};".format(z)
cursor.execute(q2)
r = cursor.fetchone()
if r:
Return_Date = input("Enter Return date : ")
Returned_Books = int(input("Enter no of books
to be returned : "))
remcopies = r[1]+Returned_Books
q3 = "INSERT INTO returns
VALUES({},'{}',{},{},{});".format(Return_I
D,Return_Date,x,z,Returned_Books)
cursor.execute(q3)
q4 = "UPDATE book SET Rem_Copies = {} WHERE
Book_ID = {};".format(remcopies,z)
cursor.execute(q4)
mydb.commit()
print("\n")
print("Book Returned Successfully. .. ")
print("\n")
else:
print("\n")
print("ERROR : Incorrect Book ID !!!!!")
print("\n")
else:
print("\n")
print("ERROR : Incorrect Member ID !!!!!!")
print("\n")
except:
print("\n")
print("Something went wrong")
print("\n")

# to diaplay book details


def book_details():
qry="SELECT * FROM book"
cursor.execute(qry)
print(tabulate(cursor,headers=["Book_ID","Book_Name","Autho
r","Price","No_Copies","Rem_Copies"],tablefmt =
"psql"))
print("\n")

# to display member details


def member_details():
qry="SELECT * FROM member"
cursor.execute(qry)
print(tabulate(cursor,headers=["Member_ID","Member_Name","
Member_Add","Contact_No"],tablefmt = "psql"))
print("\n")
37

# to display issued book details


def issue_details():
qry="SELECT * FROM issue"
cursor.execute(qry)
print(tabulate(cursor,headers=["Issue_ID","Issue_Date","Me
mber_ID","Book_ID","Issued_Books"],tablefmt =
"psql"))
print("\n")

# to display returned book details


def return_details():
qry="SELECT * FROM returns"
cursor.execute(qry)
print(tabulate(cursor,headers=["Return_ID","Return_Date","
Member_ID","Book_ID","Returned_Books"],tablefmt =
"psql"))
print("\n")
38

===============================================
MAIN MENU

BOOK DETAILS MENU DRIVE


39

ADDING BOOK DETAILS


40

VIEWING BOOK DETAILS

EDITING BOOK DETAILS


41

AFTER UPDATING BOOK DETAILS THE


MODIFIED BOOK DETAILS ARE

SEARCHING A BOOK
42

DELETING A RECORD OF BOOK

AFTER DELETING A BOOK


43

MEMBER DETAILS MENU DRIVE

ADDING MEMBER DETAILS


44

VIEWING MEMBER DETAILS

UPDATING MEMBER ADDRESS


45

AFTER UPDATING MEMBER DETAILS THE


MODIFIED MEMBER DETAILS ARE

SEARCHING A MEMBER

DELETING A RECORD OF MEMBER


46

ISSUE AND RETURN BOOK MENU DRIVE

VIEWING BOOK DETAILS

VIEWING MEMBER DETAILS


47

ISSUING A BOOK

AFTER ISSUING BOOK DETAILS

ISSUE DETAILS TABLE

RETURNING A BOOK
48

AFTER RETURNING BOOK DETAILS

RETURNING BOOK DETAILS


49

The list of websites and books which are referred during


the development of “SCHOOL MANAGEMENT
SYSTEM” are -

WEBSITES :
❖ https://www.google.co.in
❖ https://pythontrends.wordpress.com
❖ https://code-projects.org
❖ https://www.w3schools.com
❖ https://www.educative.io

BOOKS :
➢ Computer Science with Python-
Class XII

By: Preeti Arora


➢ Computer Science with Python-
Class XII
By: Sumit Arora
➢ Computer science textbook class XII-
N.C.E.R.T

You might also like