0% found this document useful (0 votes)
27 views20 pages

Laksh New

Uploaded by

2007lakshjha
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)
27 views20 pages

Laksh New

Uploaded by

2007lakshjha
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/ 20

Session 2024-2025

LIBRARY MANAGEMENT

Submitted to
Central Board of Secondary Education

Submitted By:
Lakshy Jha
XII SCIENCE

1
CERTIFICATE

This is to certify that the project work follows in

writing is genuine. It is prepared and accumulated by

the students to the best of my knowledge as it to be

submitted to the “Central Board of Secondary

Education” for the requirement of practical

examination for the academic year 2024-2025. The

following project has been completed with prior

approval of the school.

Principal

Internal External
Examiner Examiner

2
ACKNOWLEDGEMENT

Firstly I would like to thank our Principal Sir


Mr.Prashant Sharma who gave me the golden
opportunity to make this project. I would also like to
thank my teacher Mrs. Shraddha Trivedi to guide us
throughout the project.

I would like you thank my parents who had their full


support whenever I needed their help.

Last but not the least I would like to thank my friends


who also equally contributed to help me complete the
project successfully.

3
Introduction:

The Library Management System is a database-driven


application that automates the process of managing books
in a library. This system allows users to add new books,
view available books, delete books, issue books, return
books, and track the status of issued books. The system is
designed to simplify the library's day-to-day operations by
providing an easy-to-use interface for both library staff
and users. It is built using MySQL for database
management and Python for implementing the system
logic and user interface.

4
Objective:

1. Efficient Book Management:


The objective of this project is to develop a system
that allows easy management of library books,
including the ability to add, delete, and update the
status of books.
2. Issuing and Returning Books:
The system aims to automate the issuing and
returning of books, updating the status of the book
(e.g., available or issued) accordingly.
3. Tracking Issued Books:
The system maintains a record of issued books along
with relevant details like issuer name, issue date, and
return date.
4. Database Management:
To implement a centralized database that stores
information about books, issues, and returns, ensuring
data integrity and easy retrieval of information.

5
Limitation of the Project:

1. Manual Input of Data:


The project relies on user input for adding, updating,
and deleting books. Any errors in data input can
affect the overall functioning of the system.
2. No User Authentication:
The system does not have any user authentication or
authorization mechanism, which means anyone can
perform actions like issuing or deleting books.
Implementing user roles (e.g., admin and user) would
enhance security.
3. Limited Functionality:
The current version of the system does not support
advanced features such as overdue book tracking,
fines calculation, or advanced search options.
4. Lack of Data Validation:
While the system takes input from the user, it does
not check for data consistency or validate the input
rigorously. Invalid or incorrect data entries can lead
to system malfunction.
5. No Data Backup/Recovery:
The project does not include a backup mechanism. If
the database gets corrupted or deleted, the data would

6
be lost, which can be addressed with backup and
recovery features.

7
Hardware Requirements:

1. Computer/Laptop:
A basic computer or laptop with the required
operating system (Windows/Linux/Mac) for running
the Python script and MySQL server.
2. Storage Device:
Sufficient storage to store the MySQL database and
Python scripts.
3. Internet Connection:
Needed for installing packages like MySQL
Connector and Python libraries (if not already
installed).

8
Software Requirements:

1. Operating System:
Windows/Linux/Mac OS.
2. Python:
Python 3.x, which is the programming language used
for implementing the logic behind the Library
Management System.
3. MySQL:
MySQL 5.x or above is used to manage the database
and store information regarding the books and issued
records.
4. MySQL Connector for Python:
The mysql.connector Python module is required to
connect Python with the MySQL database. It can be
installed using the following command:
bash Copy code pip install
MySQL-connector-python
5. Text Editor or IDE:
Any code editor or Integrated Development
Environment (IDE) like Visual Studio Code,
PyCharm, or Sublime Text for writing and editing the
Python code.

9
Source Code
import mysql.connector

# Connect to MySQL database mydb

= mysql.connector.connect(

host="localhost",

user="root",

password="vaidehi",

database="library1"

# Create a cursor object mycursor

= mydb.cursor()

# Function to add a book def

add_book():

print("Adding a new book to the library.")

book_name = input("Enter the book name: ")

author = input("Enter the author's name: ") genre =

input("Enter the genre of the book: ") status =

input("Enter the status (available/issued): ")

sql = "INSERT INTO books (book_name, author, genre, status) VALUES (%s, %s, %s, %s)"

values = (book_name, author, genre, status)

mycursor.execute(sql, values)

mydb.commit()

10
print("Book added successfully.")

# Function to display all books def

view_books():

print("Displaying all books in the library:")

mycursor.execute("SELECT * FROM books")

books = mycursor.fetchall()

if len(books) == 0:

print("No books found in the library.")

else: for book in

books:

print(f"ID: {book[0]}, Name: {book[1]}, Author: {book[2]}, Genre: {book[3]}, Status: {book[4]}")

# Function to delete a book by ID def

delete_book():

book_id = input("Enter the ID of the book to delete: ")

sql = "DELETE FROM books WHERE book_id = %s"

mycursor.execute(sql, (book_id,)) mydb.commit()

print(f"Book with ID {book_id} deleted successfully.")

# Main menu function

def library_menu():

while True:

print("\nLibrary Management System")

print("1. Add a book")

print("2. View all books")

print("3. Delete a book")

print("4. Issue a book")

11
print("5. Issued Books")

print("6. Return Book")

print("7. Exit")

choice =int(input("Enter your choice: "))

if choice == 1:

add_book() elif

choice == 2:

view_books() elif

choice == 3:

delete_book()

elif choice==4:

mycursor.execute("Select * from books")

r=mycursor.fetchall()

for i in r:

print(i)

iname=input("Enter issuer name")

bname=input("Enter book name") idate=input("ENTER

todays date as(yyyy-mm-dd)") rdate=input("Enter the

return date")

mycursor.execute("insert into
issue(issue,book,idate,rdate)values('{}','{}','{}','{}')".format(iname,bname,idate,rdate))

mycursor.execute("update books set status='{}' where book_name='{}'".format("Issued",bname))

mydb.commit()

elif choice==5:

mycursor.execute("Select * from issue")


r=mycursor.fetchall()

12
for i in r:

print(i)

elif choice==6:

bname=input("Enter the book name you want to return")

mycursor.execute("update books set status='{}'where


book_name='{}'".format("Available",bname)) mycursor.execute("delete
from issue where book='{}'".format(bname))

elif choice ==7:

print("Exiting the system.")

break else:

print("Invalid choice. Please select a valid option.")

# Run the menu function library_menu()

13
SQL TABLE-

14
OUTPUT
1.ADD A BOOK

2.View ALL BOOKS

15
3.DELETE A BOOK

4.Issue A Book

16
5.Issued Books

6.Return Book

7.Exit
Exit successfully

17
Bibliography
1. Python Documentation o
Author(s): Python Software
Foundation o Publisher:
Python.org o Website:
https://docs.python.org/
o Content Referenced: Python programming
language documentation, libraries, and modules
used in the project.
2. MySQL Documentation o
Author(s): Oracle Corporation o
Publisher: MySQL
o Website: https://dev.mysql.com/doc/
o Content Referenced: Information on MySQL
database management system, SQL queries, and
MySQL Connector for Python.

18
3."Python for Data Analysis" o
Author(s): Wes McKinney o
Publisher: O'Reilly Media o Year:
2018

o Content Referenced: Understanding Python’s


data manipulation capabilities used in handling
MySQL data and integrating with Python.
4."Learning SQL" o Author(s): Alan
Beaulieu o Publisher: O'Reilly
Media o Year: 2009
o Content Referenced: SQL basics, working with
databases, and database design concepts used in
the Library Management System project.
5.Online Resources o Website:
GeeksforGeeks
o Content Referenced: Tutorials on Python,
MySQL, and general database concepts.
o Accessed on: [Date]

19
6."Database Management
Systems"
o Author(s): Raghu Ramakrishnan, Johannes
Gehrke o Publisher:
McGraw-Hill o Year: 2003

o Content Referenced: Database principles,


relational databases, and SQL for backend
operations of the Library Management System.
7.YouTube Tutorials and
Documentation
o Content Referenced: Practical tutorials on setting
up MySQL, Python, and integrating
MySQL with Python for building applications.

20

You might also like