0% found this document useful (0 votes)
13 views

CsFile

The document is a project report for a Library Management System developed by Ojas Garg for the class XII practical examination of the Central Board of Secondary Education for the year 2024-25. It includes acknowledgments, a certificate of completion, an index of topics, and detailed sections on the introduction, Python code implementation, and functionalities such as book and member management. The project aims to automate library tasks to improve efficiency, accuracy, and user experience using Python and SQL.

Uploaded by

gargojas31
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)
13 views

CsFile

The document is a project report for a Library Management System developed by Ojas Garg for the class XII practical examination of the Central Board of Secondary Education for the year 2024-25. It includes acknowledgments, a certificate of completion, an index of topics, and detailed sections on the introduction, Python code implementation, and functionalities such as book and member management. The project aims to automate library tasks to improve efficiency, accuracy, and user experience using Python and SQL.

Uploaded by

gargojas31
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/ 34

ACKNOWLEDGEMENT

I thank the staff of the Computer Science department for the


help and guidance provided to me in completing the project in
Computer Science. I also thank the principal for permitting the
use of the resources of the school for completing the project.

Name of the Candidate: Ojas Garg


Roll Number: 16
CERTIFICATE

This is to certify that the Computer Science project


“library Management System” in Computer Science had
been Submitted by the candidate: Ojas Garg With roll
number: 16 for the class XII practical examination of
the Central Board of Secondary Education in the year
2024-25. It is further certified that this project is the
individual work of the Candidate.

Signature:
INDEX

S.NO. TOPIC DATE SIGNATURE

1. Introduction to topic 07-01-2025

2. Python work 07-01-2025

3. SQL 07-01-2025

4. Output 07-01-2025

5. Explanation of code 07-01-2025

6. Bibliography 07-01-2025
INTRODUCTION TO TOPIC
Library Management System

Introduction to Library Management System


In today's digital age, libraries are increasingly adopting technology to streamline
their operations and enhance user experiences. A Library Management System
(LMS) is a software application designed to automate various library tasks,
making them more efficient and accessible.

This project focuses on developing a basic LMS that will assist both library staff
and patrons. The system will handle core functionalities such as:

 Book Catalogue Management:


o Adding, searching, and updating book records (title, author, availability, etc.)

 Member Management:

o Registering new members and managing their information (name, ID, contact,
etc.)

 Borrowing and Returning Books:

o Issuing books to members with due dates.


o Recording book returns.

By automating these tasks, the LMS aims to:

 Reduce administrative workload: Freeing up library staff to focus on other


important duties, such as reader services and outreach.
 Improve accuracy and efficiency: Minimizing errors and ensuring timely
processing of library transactions.
 Enhance user experience: Providing patrons with convenient access to library
resources and information.
This project will be developed using Python, leveraging its versatility and
extensive libraries. The system will incorporate user-friendly interfaces, robust
data storage mechanisms, and efficient algorithms to deliver a reliable and
effective library management solution.

Key Features:
 User-friendly interface: Easy-to-use for both library staff and patrons.
 Comprehensive book catalog: Efficient search and retrieval of book
information.
 Member management: Streamlined registration and tracking of member
activities.
 Borrowing and returning functionality: Seamless book issuance and return
processes.

This project will serve as a valuable learning experience in software development


and provide a foundation for further enhancements and customizations to suit the
specific needs of a library.

PYTHON WORK
1.LibraryManager.py

# importing necessary modules


import Menulib
import Book

while True: # main menu loop


Book.clrscreen()
print("\t\t\t Library Management\n")
print("1. Book Management")
print("2. Members Management")
print("3. Issue/Return Book")
print("4. Exit")
print("")
choice=int(input("Enter Choice between 1 to 4------->: "))
if choice==1:
Menulib.MenuBook()
elif choice==2:
Menulib.MenuMember()
elif choice==3:
Menulib.MenuIssueReturn()

elif choice==4:
break
else:
print("Wrong Choice......Enter Your Choice again")
x=input("Enter any key to continue")

2.Menulib.py
# important necessary modules
import Book
import Member
import issue

def MenuBook(): # Book menu


while True:

print("\t\t\t Book Record Management\n")


print(" ")
print("1. Add Book Record")
print("2. Display Book Records")
print("3. Search Book Record")
print("4. Delete Book Record")
print("5. Update Book Record")
print("6. Return to Main Menu")
print(" ")
choice=int(input("Enter Choice between 1 to 5---->:"))
if choice==1:
Book.insertData()
elif choice==2:
Book.display()
elif choice==3:
Book.SearchBookRec()
elif choice==4:
Book.deleteBook
elif choice==5:
Book.UpdateBook()
elif choice==6:
return # get out of the Book Menu
else:
print("Wrong Choice......Enter Your Choice again")
x=input("Enter any key to continue")

def MenuMember(): #Library Member Menu


while True:

print("\t\t\t Member Record Management\n")


print("="*50)
print("1. Add Member Record")
print("2. Display Member Records")
print ("3. Search Member Record")
print("4. Delete Member Record")
print ("5. Update Member Record")
print("6. Return to Main Menu")
print("="*50)
choice=int(input("Enter Choice between 1 to 5--->: "))
if choice==1:
Member.insertMember()
elif choice == 2:
Member.display()
elif choice == 3:
Member.SearchMember()
elif choice == 4:
Member.deleteMember()
elif choice == 5:
Member.UpdateMemberDetails()
elif choice==6:
return #get out of the member menu
else:
print("Wrong Choice...Enter Your Choice again")
x=input ("Enter any key to continue")

def MenuIssueReturn(): # Book Issue Menu


while True:

print("\t\t\t Issue Record Management\n")


print("="*50)
print ("1. Issue Book")
print("2. Display Issued Book Records")
print("3. Return Issued Book")
print ("4. Return to Main Menu")
print("="*50)
choice=int(input("Enter Choice between 1 to 4---->:"))
if choice==1:
issue.issueBook()
elif choice==2:
issue.ShowIssuedBooks()
elif choice==3:
issue.returnBook()
elif choice==4:
return # get out of the issue menu
else:
print("Wrong Choice......Enter Your Choice again")
x=input("Enter any key to continue"

3.Member.py
# importing necessary modules
import mysql.connector
from datetime import date

def clrscreen(): # creates empty spaces on the output window


print('\n'*5)

def display():
# connecting with mysql database and making cursor
cnx=mysql.connector.connect(user='root',passwd='root',
host='localhost',
database='library')
Cursor = cnx.cursor()
query = ("SELECT * FROM Member")
Cursor.execute(query)
for (Mno, Mname, MOB, DOP, ADR) in Cursor:
print("="*50)
print("Member Code :",Mno)
print("Member Name :",Mname)
print("Mobile No. of Member :",MOB)
print("Date of Membership :",DOP)
print("Address :",ADR)
print("="*50)
#prints each record of the member table
Cursor.close() # closing the cursor
cnx.close() # closing the mysql connection
print("You have done it!!!!!!!")

def insertMember():
# connecting with mysql database and making cursor
cnx=mysql.connector.connect(user='root',passwd='root',
host='localhost',
database='Library')

Cursor = cnx.cursor()
mno = input("Enter Member Code : ")
mname = input("Enter Member Name : ")
mob = input("Enter Member Mobile No. : ")
print("Enter Date of Membership(Date, Month and Year
seperately): ")
DD = int(input("Enter Date : "))
MM = int(input("Enter Month : "))
YY = int(input("Enter Year : "))
addr =input("Enter Member Address : ")
Qry =("INSERT INTO Member VALUES (%s, %s, %s, %s,%s)")
data = (mno, mname, mob, date(YY, MM, DD), addr)
Cursor.execute(Qry, data)
# runs the query, substituting values from data tuple
# Make sure data is committed to the database
cnx.commit()
Cursor.close() # closing the cursor
cnx.close() # closing the mysql connection
print("Record Inserted............")

def deleteMember():
# connecting with mysql database and making cursor
cnx=mysql.connector.connect(user='root',passwd='root',
host='localhost',
database='Library')
Cursor = cnx.cursor()
mno = input("Enter Member Code of the Member to be
deleted from the Library : ")
Qry = ("DELETE FROM Member WHERE MNO = %s")
del_rec = (mno,)
Cursor.execute(Qry, del_rec)
#runs the query,substituting values from del_rec tuple
# Make sure data is committed to the database
cnx.commit()
Cursor.close() # closing the cursor
cnx.close() # closing the mysql connection
print (Cursor.rowcount, "Record(s) Deleted
Successfully..........")

def SearchMember():
# connecting with mysql database and making cursor
cnx=mysql.connector.connect(user='root',passwd='root',
host='localhost',
database='Library')
Cursor = cnx.cursor()
mno=input("Enter Member Code to be Searched: ")
query = ("SELECT * FROM Member where Mno = %s")
rec_srch=(mno,)
Cursor.execute(query, rec_srch)
#runs the query,substituting value from rec_srch tuple
Rec_count=0
for (Mno, Mname, MOB, DOP, ADR) in Cursor:
Rec_count += 1
print("="*50)
print("Member Code : ", Mno)
print ("Member Name : ", Mname)
print("Mobile No.of Member : ", MOB)
print ("Date of Membership : ", DOP)
print ("Address : ",ADR)
print("="*50)
#prints each record of the member table
if Rec_count%2==0:
input ("Press any key to continue")
clrscreen()
print (Rec_count, "Record(s) found")
# Make sure data is committed to the database
cnx.commit()
Cursor.close() # closing the cursor
cnx.close() # closing the mysql connection

def UpdateMemberDetails():
# connecting with mysql database and making cursor
cnx=mysql.connector.connect(user='root',
passwd='root',
host='localhost',
database='Library')
Cursor = cnx.cursor()
mno=input("Enter Member Code for the member to be
Updated: ")
query = ("SELECT * FROM Member where Mno = %s")
rec_srch=(mno,)
#runs the query,substituting value from rec_srch tuple
Cursor.execute(query, rec_srch)
for (Mno, Mname, MOB, DOP, ADR) in Cursor:
print("="*50)
print("Member Code : ", Mno)
print ("Member Name : ", Mname)
print("Mobile No.of Member : ", MOB)
print ("Date of Membership : ", DOP)
print ("Address : ",ADR)
print("="*50)
#prints each record of the member table
print("Enter new data:")
mname = input("Enter Member Name : ")
mob = input("Enter Member Mobile No. : ")
print("Enter Date of Membership (Date/Month and Year
seperately) : ")
DD = int(input("Enter Date : "))
MM = int(input("Enter Month : "))
YY = int(input("Enter Year : "))
addr = input("Enter Member Address : ")
Qry = ("UPDATE member SET Mno=%s, Mname=%s, mob=%s, \
d_o_member=%s, addr = %s WHERE Mno=%s")
data = (mno, mname, mob, date(YY, MM, DD), addr,mno)
Cursor.execute(Qry, data)
#runs the query, substituting values from data tuple
# Make sure data is committed to the database
cnx.commit()
Cursor.close() # closing the cursor
cnx.close() # closing the mysql connection
print("Record Updated............")

4.Book.py
#importing necessary modules
import mysql.connector
from datetime import date

def clrscreen(): # creates empty spaces on the output window


print("\n"*5)

def display():
# connecting with mysql database and making cursor
cnx = mysql.connector.connect(user='root',
password='root',
host='localhost',
database='Library')
Cursor = cnx.cursor()
query = "SELECT * FROM BookRecord"
Cursor.execute(query)
for(Bno,Bname,Author,price,publ,qty,d_o_purchase) in \
Cursor:
print("="*50)
print("Book Code :", Bno)
print("Book Name :", Bname)
print("Author of Book :", Author)
print("Price of Book :", price)
print("Publisher :", publ)
print("Total Quantity in Hand :", qty)
print("Purchased On :", d_o_purchase)
print("="*50)
#prints each record of the bookrecord table
Cursor.close() # closing the cursor
cnx.close() # closing the mysql connection
print("You have done it!!!!!!")
def insertData():
# connecting with the mysql database and making cursor
cnx = mysql.connector.connect(user='root',
password='root',
host='localhost',
database='Library')
Cursor = cnx.cursor()
bno=input("Enter Book Code: ")
bname=input("Enter Book Name: ")
Auth=input("Enter Book Author's Name: ")
price=int(input("Enter Book Price: "))
publ=input("Enter Publisher of Book: ")
qty=int(input("Enter Quantity purchased: "))
print("Enter Date of Purchase (Date/Month and Year
separately): ")
DD=int(input("Enter Date: "))
MM=int(input("Enter Month: "))
YY=int(input("Enter Year: "))
Qry = ("INSERT INTO BookRecord VALUES (%s, %s, %s, %s,
%s, %s, %s)")
data = (bno, bname,Auth,price,publ,qty,date(YY,MM,DD))
Cursor.execute(Qry, data)
# runs the query, substituting values from data tuple
# Make sure data is committed to the database
cnx.commit()
Cursor.close() # closing the cursor
cnx.close() # closing the mysql connection
print("Record Inserted............")

def deleteBook():
# connecting with mysql database and making cursor
cnx = mysql.connector.connect(user='root',
password='root',
host='localhost',
database='Library')
Cursor = cnx.cursor()
bno = input("Enter Book Code of the Book to be deleted
from the Library: ")
Qry = "DELETE FROM BookRecord WHERE BNO = %s"
del_rec = (bno,)
Cursor.execute(Qry, del_rec)
#runs the query,substituting values from del_rec tuple
# Make sure data is committed to the database
cnx.commit()
Cursor.close() # closing the cursor
cnx.close() # closing the mysql connection
print(Cursor.rowcount, "Record(s) Deleted
Successfully............")

def SearchBookRec():
#connecting with mysql database and making cursor
cnx = mysql.connector.connect(user='root',
password='root',
host='localhost',
database='Library')
Cursor = cnx.cursor()
bno = input("Enter Book No to be Searched from the
Library: ")
query = ("SELECT * FROM BookRecord where BNo = %s ")
rec_srch=(bno,)
Cursor.execute(query,rec_srch)
#runs the query,substituting value from rec_srch tuple
Rec_count=0
for(Bno,Bname,Author,price,publ,qty,d_o_purchase) in \
Cursor:
Rec_count+=1
print(" ")
print("Book Code :",Bno)
print("Book Name :",Bname)
print("Author of Book :",Author)
print("Price of Book :",price)
print("Publisher :",publ)
print("Total Quantity in Hand :",qty)
print("Purchased On :",d_o_purchase)
print(" ")
# prints each record of the bookrecord table
if Rec_count>=0:
input("Press any key to continue")
print(Rec_count,"Record(s) found")
# Make sure data is committed to the database
cnx.commit()
Cursor.close() # closing the cursor
cnx.close() # closing the mysql connection

def UpdateBook():
# connecting with mysql database and making cursor
cnx = mysql.connector.connect(user='root',
password='root',
host='localhost',
database='Library')
Cursor = cnx.cursor()
bno=input("Enter Book Code of the Book to be Updated
from the Library : ")
query = ("SELECT * FROM BookRecord where BNo = %s ")
rec_srch=(bno,)
Cursor.execute(query,rec_srch)
#runs the query,substituting value from rec_srch tuple
for(Bno,Bname,Author,price,publisher,qty,\
d_o_purchase) in Cursor:
print("="*50)
print("Book Code : ", Bno)
print ("Book Name : ", Bname)
print("Author : ", Author)
print ("Price : ", price)
print ("publisher : ",publisher)
print("quantity :",qty)
print("date of purchase :",d_o_purchase)
print("="*50)
# prints each record of the bookrecord table
print ("Enter new data: ")
bname=input("Enter Book Name: ")
Auth=input("Enter Book Author's Name:")
price=int(input("Enter Book Price: "))
publ=input("Enter Publisher of Book: ")
qty=int(input("Enter Quantity purchased: "))
print("Enter Date of Purchase Date,Month and Year
seperately: ")
DD=int(input("Enter Date: "))
MM=int(input("Enter Month: "))
YY=int(input("Enter Year: "))
Qry = ("update Bookrecord set Bname=%s, Author=\
%s,price=%s,publisher=%s,qty=%s,\
d_o_purchase=%s WHERE Bno=%s")
data = (bname, Auth, price, publ,qty, date(YY, MM,
DD),bno)
Cursor.execute(Qry, data)
#runs the query, substituting values from data tuple
# Make sure data is committed to the database
cnx.commit()
Cursor.close() # closing the cursor
cnx.close() # closing the mysql connection
print (Cursor.rowcount, "Record(s) Updated
Successfully........")

5.issue.py
# importing necessary modules
import mysql.connector
from datetime import date

def clrscreen(): # creates empty spaces on the output window


print('\n'*5)

def ShowIssuedBooks():
# connecting with mysql database and making cursor
cnx = mysql.connector.connect(user='root',
password='root',
host='localhost',
database='Library')
Cursor = cnx.cursor()
query = ("SELECT I.bno, B.bname, I.mno, M.mname,\
d_o_issue, d_o_ret FROM bookRecord B,\
issue I,member M where B.bno=I.bno and \
I.mno=M.mno")
Cursor.execute(query)“””query for the records where
Book code and Member code are
same”””
for (Bno, Bname, Mno, Mname, doi, dor) in Cursor:
print(" ")
print("Book Code :", Bno)
print("Book Name :", Bname)
print("Member Code :", Mno)
print("Member Name :", Mname)
print("Date of issue :", doi)
print("Date of return :", dor)
print(" ")
“””prints each record of the issue table along
with Bname column from bookrecord, Mname column
from member”””
Cursor.close() # closing the cursor
cnx.close() # closing the mysql connection
print("You have done it!!!!!!!")

def issueBook():
# connecting with mysql database and making cursor
cnx = mysql.connector.connect(user='root',
password='root',
host='localhost',
database='Library')
Cursor = cnx.cursor()
bno = input("Enter Book Code to issue : ")
mno = input("Enter Member Code : ")
print("Enter Date of Issue (Date/Month and Year
separately): ")
DD = int(input("Enter Date : "))
MM = int(input("Enter Month : "))
YY=int(input("Enter Year : "))
Qry = ("INSERT INTO issue (bno,mno,d_o_issue) VALUES
(%s, %s, %s)")
data = (bno,mno,date(YY,MM,DD))
Cursor.execute(Qry,data)
#runs the query, substituting values from data tuple
cnx.commit()
Cursor.close() # closing the cursor
cnx.close() # closing the mysql connection
print("Record Inserted............")

def returnBook():
# connecting with the mysql database and making cursor
cnx = mysql.connector.connect(user='root',
password='root',
host='localhost',
database='Library')
Cursor = cnx.cursor()
bno = input("Enter Book Code of Book to be returned to
the Library : ")
Mno = input("Enter Member Code of Member who is
returning Book : ")
retDate = date.today()
Qry =("Update Issue set d_o_ret=%s WHERE BNO = %s
and Mno = %s")
rec =(retDate,bno,Mno)
Cursor.execute(Qry,rec)
#runs the query, substituting values from rec tuple
# Make sure data is committed to the database
cnx.commit()
Cursor.close() # closing the cursor
cnx.close() # closing the mysql connection
print(Cursor.rowcount,"Record(s) Updated
Successfully............")
SQL
OUTPUTS
Output 1 ->
(A ) To Add Book Record

(B) To Display Book Record


(C) To Search Book Record

(D) To Delete Book Record

(E) To Update Book Record


Output 2 ->

(A ) To Add Member Record

(B) To Display Member Record


(C) To Search Member Record

(D) To Delete Member Record

(E) To Update Member Record


Output 3 ->
(A) Issue of a Book

(
B) Display of Issued Book Records

(C) Return of Issued Book


EXPLANATION OF CODE

In this code we have created three functions by


ourselves –

1. LibraryManager.py
Overview: This file acts as the main interface for the library management system. It provides a menu-
driven console interface for users to navigate different sections of the system, such as managing
books, members, and issuing or returning books.

Functionality:

 Main Menu: Presents a menu to the user with options to manage books, members, or handle
book issues/returns.
 Input Handling: Continuously prompts the user to enter their choice and invokes
corresponding functions from other modules (Menulib).
 Navigation: Based on user input, the program directs to the specific functions for book
management (MenuBook), member management (MenuMember), or issue/return
operations (MenuIssueReturn).

Purpose: This file serves as the central hub, coordinating between different parts of the system,
ensuring users can easily access various functionalities.

2. Menulib.py
Overview: Menulib.py is responsible for defining the menus related to book management,
member management, and book issue/return operations. It structures the user’s interactions within
these areas.

Functionality:

 MenuBook: Presents options for book-related actions such as adding, displaying, searching,
deleting, and updating book records.
 MenuMember: Offers options to manage library members, including adding new members,
viewing member details, searching for members, and updating member information.
 MenuIssueReturn: Provides options for issuing books to members, returning books, and
viewing issued books.

Purpose: This module organizes the user interface into manageable segments for different operations,
making it easier for users to interact with specific aspects of the library system.

3. Member.py
Overview: Member.py handles all operations related to library members. This includes CRUD
operations (Create, Read, Update, Delete) for member records in the database.

Functionality:

 Adding Members: Allows users to input new member information and stores it in the
database.
 Displaying Members: Retrieves and shows all member records from the database.
 Searching Members: Provides functionality to search for specific members using their unique
member code.
 Deleting Members: Facilitates the removal of a member’s record from the database.
 Updating Member Details: Enables updates to existing member information, such as contact
details or address.

Purpose: This module is essential for maintaining an up-to-date and accurate member database,
ensuring that the library can manage its members effectively.

4. Book.py
Overview: Book.py focuses on the management of books within the library. Similar to Member.py,
it provides CRUD operations for books.

Functionality:

 Inserting New Books: Users can add new books to the library’s collection by entering details
like title, author, and publication date.
 Displaying Books: Retrieves and displays all books available in the library’s database.
 Searching Books: Users can search for specific books using book codes or other identifying
information.
 Deleting Books: Removes a book from the library’s records.
 Updating Book Information: Allows for updates to book details such as price, quantity, or
publisher.
Purpose: This module ensures the library’s book inventory is well-managed, making it easier to keep
track of available books and their details.

5. issue.py
Overview: issue.py manages the process of issuing books to members and recording their return.
It ensures that book transactions are properly tracked.

Functionality:

 Issuing Books: Records the transaction when a member borrows a book, including the issue
date.
 Returning Books: Updates the system when a member returns a book, ensuring accurate
tracking of which books are currently borrowed.
 Displaying Issued Books: Lists all books that are currently issued, along with details such as the
member who borrowed them and the dates of issue and expected return

Purpose: This module plays a crucial role in monitoring the circulation of books within the library,
preventing losses and ensuring timely returns.

Database Interaction
Each module interacts with a MySQL database to perform its operations. The database likely contains
tables for books, members, and issued books, with each table storing relevant details:

 Books Table: Stores information like book ID, title, author, price, publisher, and quantity.
 Members Table: Contains member ID, name, contact details, and membership date.
 Issues Table: Tracks which books have been issued to which members, along with issue and
return dates.

Overall System Flow


1. User Interaction: The user interacts with the system through LibraryManager.py,
selecting options from the main menu.
2. Function Calls: Based on the user's selection, the corresponding functions in Menulib.py
are invoked, directing the user to the specific area they want to manage.
3. Database Operations: Each operation (whether adding a book, issuing a book, or updating a
member) involves interacting with the MySQL database, executing SQL queries to insert,
update, delete, or fetch data.
4. Feedback: The system provides feedback after each operation, such as confirming a successful
addition of a book or displaying the results of a search query.
BIBLIOGRAPHY

 Computer Science with Python by Preeti Arora Class 12


 mysql.com
 python.org

You might also like