Supriya
Supriya
ing zaff
S
ng at a
rp
La
ur
(Run under BRABU Bihar University)
A Mini Project Report on
Library Management System
For Python (502 and 506)
Thank you.
Declaration
I, Supriya Kumari, hereby declare that the mini project entitled
"Library Management System" submitted in partial fulfilment of
the requirements for BCA at Langat Singh College, Muzaffarpur is
entirely my own work, conducted under the guidance of Mr.
Ravikant Sir.
I affirm that:
1. The contents of this project report are original and have not
been submitted, in part or in whole, for any other degree or
qualification.
2. Any sources of information used in this project report have
been properly acknowledged and referenced.
3. The experiments, analyses, and findings presented in this
report are genuine and have not been manipulated or falsified
in any manner.
4. Any assistance received from individuals or institutions
during the course of this project has been duly acknowledged.
I understand that any act of plagiarism or academic dishonesty in
this project would constitute a breach of academic integrity and
could lead to disciplinary action.
Supriya Kumari
Date:
Project Report:
Library Management System
Introduction:
The Library Management System is a software application
developed to handle day-to-day operations in a library. This
system provides a simple interface for managing books,
tracking issued and returned books, and maintaining a record
of borrowers. The main aim is to digitize the manual
process, making it more efficient and reliable.
▪ Objective:
• To provide a user-friendly platform to manage library
records efficiently.
• To enable easy tracking of books, including issuing,
returning, and managing their availability status.
• To maintain a record of borrowers and issued books to
avoid any discrepancies.
Hardware Requirements:
• Processor: Intel Core i3 or above.
• RAM: 512 MB or higher.
• Hard Disk: 500 MB of Free space.
Software Requirements:
• Python 3.1.11 or above.
• MySQL Server.
• MySQL Connector Library (mysql.connector).
MySQL Schema
Database Creation:
CREATE DATABASE library_db;
USE library_db;
Scopes:
• Book Management: Allows the addition of new books
to the library inventory and updates book availability.
• Borrower Management: Keeps a record of borrowers,
including which books they have borrowed.
• Book Issuing and Returning: Manages the process of
issuing and returning books, ensuring availability status
updates.
Limitations:
• Local Application: The current implementation is
intended for local use only, as the database is hosted
locally and the application runs as a desktop application.
• Scalability: Designed for small to medium-sized rental
agencies. To support a larger scale with more
transactions, the application would require optimization
and potential migration to a cloud-based database.
• Customer Management: The current scope does not
include comprehensive customer management or user
authentication. It focuses primarily on the vehicle rental
process.
Future Enhancement
Enhance UI Design:
Improve the user interface with a better layout and
styling using frameworks like ttk for a more modern
look.
Add Reporting:
Generate reports of borrowed books, late returns, etc.
User Management:
Allow role-based access for library staff and members.
Method
Database Connection:
• Implementing MySQL queries to insert, update, and
fetch data.
• Using SQL queries for managing book availability and
recording rental details.
Core Functions:
• create_tables(): Initializes the database tables if they do
not already exist.
• add_book(): Adds a new book to the library database.
• view_books(): Displays the list of all books with their
availability.
• issue_book(): Issues a book to a borrower and updates
the available status.
• return_book(): Marks a book as returned and removes
the borrower record.
User Guide
Installation:
1. Ensure that Python 3.1.11 or above is installed on your
system.
2. Install the required libraries using pip:
pip install mysql-connector-python
3. Set up the MySQL database:
• Create a database named library_db.
• Execute the provided SQL schema to create the
necessary tables.
4. Download and run the application script.
Getting Started:
Launching the Application:
1. Run the Python script using the following command in
your terminal or command prompt:
python library_app.py
Viewing Books:
• Select the "View Books" option from the menu.
• The system will display a list of all books, showing:
o Book ID
o Title
o Author
o Availability (Yes/No).
Issuing Books:
• Select the "Issue Book" option from the menu.
• Enter the Book ID of the book to be issued.
• Enter the borrower's name.
• The system will update the book's availability and
confirm the book has been issued.
Returning Books:
• Select the "Return Book" option from the menu.
• Enter the Book ID of the book being returned.
• The system will mark the book as available and remove
the borrower’s record.
• A confirmation message will be displayed..
Source Code
import mysql.connector
cursor.execute("""
CREATE TABLE IF NOT EXISTS borrowers (
borrower_id INT AUTO_INCREMENT PRIMARY
KEY,
name VARCHAR(255) NOT NULL,
book_id INT,
FOREIGN KEY (book_id) REFERENCES
books(book_id)
)""")
conn.commit()
print("Tables created successfully.")
if result:
cursor.execute("DELETE FROM borrowers WHERE
book_id = %s", (book_id,))
cursor.execute("UPDATE books SET available =
TRUE WHERE book_id = %s", (book_id,))
conn.commit()
print("Book returned successfully.")
else:
print("No record of this book being issued.")
# Main program
if __name__ == "__main__":
create_tables()
while True:
print("\nLibrary Management System")
print("1. Add Book")
print("2. View Books")
print("3. Issue Book")
print("4. Return Book")
print("5. Exit")
choice = input("Enter your choice: ")
if choice == '1':
title = input("Enter book title: ")
author = input("Enter author name: ")
add_book(title, author)
else:
print("Invalid choice. Please try again.")
2. Add book:
3. Book table:
Database Maintenance:
• Backup Regularly
• Data Optimization
• Data Validation
Code Maintenance:
• Use Version Control
• Update Libraries
• Handle Errors
Security:
• Database Security
• Application Security
Bug Fixes and Updates:
• Fix Bugs Quickly
• Test New Features
• User Feedback Monitoring
Bibliography