You are on page 1of 23

_

UNDERTAKING

We declare that the work presented in this project titled “LIBRARY MANAGEMENT

SYSTEM”, submitted to Mr. Akshay Varshney PGT - Computer Science Army Public

School, LBS Marg for the award of the CBSE – AISSCE class XII certificate. For the

support of our work, we have attached a plagiarism report from Grammarly.com which is an

open-source plagiarism checker and it is according to specifications provided by CBSE.

By:
1. ANUJ SINGH – XII B – ROLL NO__________________
2. SAKSHAM RAI – XII B – ROLL NO________________
3. AVISHEKH– XII B – ROLL NO____________________

_ 2
CERTIFICATE

It is certified that the work contained in the project titled “LIBRARY MANAGEMENT
SYSTEM”, by “Anuj Singh, Saksham Rai, and Avishekh”, has been carried out under my
supervision and that this has not been submitted elsewhere for an AISSCE certificate.

Mentor:

(Mrs. Meenakshi Jayaswal)


PRINCIPAL
ARMY PUBLIC SCHOOL LBS MARG

Project Guide:

(Mr. Akshay Varshney)


PGT – COMPUTER SCIENCE
ARMY PUBLIC SCHOOL LBS MARG

External Examiner Sign


___________________

_ 3
ACKNOWLEDGEMENT

We would like to thank Mrs. Meenakshi Jayaswal, Principal, Army Public School, LBS
Marg, Lucknow who gave us this golden opportunity to do this work and are deeply indebted
to our mentor Mr. Akshay Varshney for project guidance. We further say thanks to all the
members of Army Public School, LBS Marg. We also express our deepest gratitude to our
parents and our friends, as the project is a bridge between theoretical and practical learning
and with this thinking we worked on the project and made it successful in a given amount of
time.

_ 4
CONTENT

1. Introduction

2. System Requirements

3. Coding

4. Outcomes

5. References

_ 5
INTRODUCTION

Project Description

A Library Management System (LMS) is a software application that helps manage the operations of a
library. It includes functions like cataloguing books, tracking book availability, managing membership and
facilitating, borrowing and returning of books. Here's a project description for creating a Library
Management System using MySQL and Python as shown below:

METHODOLOGY
The project starts with ‘Menu based Input’ asked from the user as –

Enter1: Add a book: This menu will add an entry of a book by entering the required details.
Enter2: Update a book: This menu will update the details of a textbook.
Enter3: Delete a book: This menu will delete the details of a textbook by entering the book ID.
Enter4: Search for a book: This menu will search for the existence of a book by entering the book ID.
Enter5: Display all books: This menu will display the entries of all the books which are stored by the user in
this Library.
Enter6: Exit

_ 6
SYSTEM REQUIREMENTS

Recommended System Requirements

Processors: Intel® Core™ i3 processor 4300M at 2.60 GHz.

Disk space: 2 to 4 GB.

Operating systems: Windows® 10, MACOS, and UBUNTU.

Python Versions: 3. X.X or Higher.

Minimum System Requirements

Processors: Intel Atom® processor or Intel® Core™ i3 processor.

Disk space: 1 GB.

Operating systems: Windows 7 or later, MACOS, and UBUNTU.

Python Versions: 2.7.X, 3.6.X.

Prerequisites before installing MySQL Connector Python

You need root or administrator privileges to perform the installation process.

Python must be installed on your machine.

Note: – MySQL Connector Python requires Python to be in the system’s PATH. Installation fails if it

doesn’t find Python.

On Windows, If Python doesn’t exist in the system’s PATH, please manually add the directory containing

python.exe yourself.

_ 7
ROLE OF TEAM MEMBERS

1. Coding : Saksham Rai

2. Analysis and Documentation : Anuj Singh

3. Error Rectification and Resource collection : Avishekh

_ 8
_ 9
CODING

import mysql.connector

# Establish the connection with the MySQL server

mydb =
mysql.connector.connect(host="localhost",user="root",password="Seniorlab@123",database="library")

# Create a cursor object to interact with the database

cursor = mydb.cursor()

# Function to display the main menu

def display_menu():

print("1. Add a book")

print("2. Update a book")

print("3. Delete a book")

print("4. Search for a book")

print("5. Display all books")

print("6. Exit")

# Function to add a book to the library

def add_book():

book_title = input("Enter the title of the book: ")

book_author = input("Enter the author of the book: ")

book_published_year = int(input("Enter the published year of the book: "))

book_id = int(input("Enter the ID of the book you want to add: "))

_ 9
sql = "INSERT INTO books (book_title, book_author, book_published_year, book_id) VALUES
(%s, %s, %s, %s)"

val = (book_title, book_author, book_published_year, book_id)

cursor.execute(sql, val)

mydb.commit()

print(cursor.rowcount, "book added successfully.")

# Function to update a book in the library

def update_book():

book_id = int(input("Enter the ID of the book you want to update: "))

book_title = input("Enter the new title of the book: ")

book_author = input("Enter the new author of the book: ")

book_published_year = int(input("Enter the new published year of the book: "))

sql = "UPDATE books SET book_title = %s, book_author = %s, book_published_year = %s WHERE
book_id = %s"

val = (book_title, book_author, book_published_year, book_id)

cursor.execute(sql, val)

mydb.commit()

print(cursor.rowcount, "book updated successfully.")

# Function to delete a book from the library

def delete_book():

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

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

val = (book_id, )

_ 10
cursor.execute(sql, val)

mydb.commit()

print(cursor.rowcount, "book deleted successfully.")

# Function to search for a book in the library

def search_book():

book_title = input("Enter the title of the book you want to search: ")

sql = "SELECT * FROM books WHERE book_title = %s"

val = (book_title, )

cursor.execute(sql, val)

result = cursor.fetchall()

if not result:

print("Book not found.")

else:

for book in result:

print("ID:", book[0])

print("Title:", book[1])

print("Author:", book[2])

print("Published Year:", book[3])

print()

# Function to display all books in the library

def display_books():

sql = "SELECT * FROM books"

cursor.execute(sql)

result = cursor.fetchall()

if not result:
_ 11
print("No books in the library.")

else:

for book in result:

print("ID:", book[0])

print("Title:", book[1])

print("Author:", book[2])

print("Published Year:", book[3])

print()

# Main program loop

while True:

display_menu()

choice = input("Enter your choice (1-6): ")

if choice == '1':

add_book()

elif choice == '2':

update_book()

elif choice == '3':

delete_book()

elif choice == '4':

search_book()

elif choice == '5':

display_books()

elif choice == '6':

break

else:

print("**** Invalid choice. Please try again. ****")

_ 12
# Close the cursor and the MySQL connection

cursor.close()

mydb.close()

# END OF THE PROJECT

_ 13
OUTCOMES

MAIN SCREEN

_ 14
ADDING A BOOK

_ 15
UPDATING A BOOK

_ 16
DELETING A BOOK

_ 17
SEARCHING FOR A BOOK

_ 18
SEARCHING FOR A BOOK

_ 19
DISPLAYING ALL THE BOOKS

_ 20
EXIT

_ 21
REFERENCES

1. https://python.org

2. https://tutorialsPoint.com

3. https://Pythonguides.com

4. https://LearnPython.org

5. https://geeksforgeeks.org

_ 22

You might also like