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

Project CS

The document outlines a project on a Library Management System created by students Pratyush and Himal Tyagi for their Computer Science class at PM SHRI Kendriya Vidyalaya, Ghaziabad. It details the project's objectives, features, table structure, source code, and software requirements, demonstrating how the system allows users to manage library operations efficiently. The project adheres to CBSE AISSCE guidelines and includes acknowledgments and credits for contributions received during its development.

Uploaded by

singhmanasmay
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)
2 views

Project CS

The document outlines a project on a Library Management System created by students Pratyush and Himal Tyagi for their Computer Science class at PM SHRI Kendriya Vidyalaya, Ghaziabad. It details the project's objectives, features, table structure, source code, and software requirements, demonstrating how the system allows users to manage library operations efficiently. The project adheres to CBSE AISSCE guidelines and includes acknowledgments and credits for contributions received during its development.

Uploaded by

singhmanasmay
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/ 23

PM SHRI KENDRIYA VIDYALAYA

KAMLA NEHRU NAGAR


GHAZIABAD

Academic Year: 2024-2025

PROJECT ON
LIBRARY MANAGEMENT SYSTEM
As per CBSE AISSCE guidelines for Board Examination

GROUP MEMBER : Pratyush, Himal Tyagi


CLASS : XII A
SUBJECT : COMPUTER SCIENCE
SUBJECT CODE : 083
PROJECT GUIDE : Mrs. KIRAN SINGH PGT(CS)

PM SHRI KENDRIYA VIDALAYA KNN GZB-I


AGRA REGION

Page 1 of 23
PM SHRI K.V. K.N.N. G.Z.B.- I

CERTIFICATE
This is to certify that Master PRATYUSH and Master HIMAL TYAGI

have successfully completed the project work entitled LIBRARY

MANAGEMENT SYSTEM in the subject Computer Science (083) laid

down in the regulations of CBSE for Class XII practical.

Internal Examiner External Examiner

Page 2 of 23
TABLE OF CONTENTS

SER DESCRIPTION PAGE NO

01 ACKNOWLEDGEMENT 04

02 INTRODUCTION 05

03 OBJECTIVES OF THE PROJECT 05

04 FEATURES OF LIBRARY MANAGEMENT 06


SYSTEM

05 TABLE STUCTURE 07-08

06 SOURCE CODE 09-16

07 OUTPUT 17-21

08 SOFTWARE REQUIREMENT 22

09 CREDITS 23

Page 3 of 23
ACKNOWLEDGEMENT

Apart from the efforts, the success of any project depends largely on the
encouragement and guidelines of many others. We take this opportunity to express
our gratitude to the people who have been instrumental in the successful completion
of this project.

We express deep sense of gratitude to almighty God for giving us strength for
the successful completion of the project.

We express our heartfelt gratitude to our parents for constant encouragement


while carrying out this project.

We gratefully acknowledge the contribution of the individuals, our teachers who


contributed to bringing this project up to this level, who continues to look after us
despite our flaws,

We express our deep sense of gratitude to the luminary computer science


teacher Mrs Kiran Singh, PM SHRI KV KNN GZB who has been continuously
motivating and extending her helping hand to us.

We express our sincerity and thanks to the academician The Principal, Vice
principal for constant encouragement and the guidance provided during this 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. We are
grateful for their constant support and help.

Page 4 of 23
PROJECT ON CREATING LIBRARY MANAGEMENT SYSTEM
INTRODUCTION

This program helps the user to manage a library. This program helps the librarian or
admin to add or remove a book from their system and view all the books that have
been borrowed, when they were borrowed and when they are to be returned.
Through this program members can search and borrow the book they desire and
return the books they have borrowed. Also new users can register themselves as
members using this program.
This program also asks for the login credentials of the members or admins before
checking them with the database and then grants access to the menus.

This program is one example of how librarians can store and fetch data within second
and efficiently.

OBJECTIVES OF THIS PROGRAM

The objective of this project is to let the students apply the programming

knowledge and set a small example how librarians can organise the library and also

exposes the students to how programming skills helps in developing a good software.

This program is based on MySQL and python connectivity.it consist of four

different my SQL table structure .One is for storing the login credentials of the

members of the library. Second one is for storing the login credentials of the

admins/librarian. Third one is for storing the information of the books in the library. Last

is for storing the information regarding all the borrowed books and it is linked with the

members tables to show who has borrowed the book.

Page 5 of 23
FEATURES OF LIBRARY MANAGEMENT

• FEATURES OF ADMIN MENU


i)To add a new book It takes details of new book
such as the title of the
book, the author of the
book and it’s publishing
date
ii)To remove a book It takes book id to delete
book of that particular id
iii)To view all the borrowed It displays information
books regarding all the books that
have been borrowed

• FEATURES OF MEMBERS MENU

i)To search for a book It takes the title of the book


as input from user and
returns all the books and
their details such as the ID
of book, it’s title, it’s author
and the date of publication.
ii)To borrow a book It takes details such as the
ID of the book, date of
borrowing and date of
return and add the data into
borrowings tables.
iii)To return a book It takes the ID of the book
and checks whether the
member returning the book
is the same as the one who
borrowed it and returns the
book if true

Page 6 of 23
TABLE STRUCSTURE FOR LIBRARY
MANAGEMENT

THERE ARE 4 TABLES TO EXECUTE THIS


SOFTWARE

• ADMINS
FIELD TYPE NULL KEY DEFAULT EXTRA
id int NO PRI NULL auto_increment

username varchar(255) NO NULL

password varchar(255) NO NULL

• MEMBERS
FIELD TYPE NULL KEY DEFAULT EXTRA
id int NO PRI NULL auto_increment

name varchar(255) NO NULL

email varchar(255) NO NULL

phone_number varchar(20) NO NULL

password varchar(255) NO NULL

• BOOKS
FIELD TYPE NULL KEY DEFAULT EXTRA
id int NO PRI NULL auto_increment

title varchar(255) NO NULL

author varchar(255) NO NULL

publication_date date NO NULL

Page 7 of 23
• BORROWINGS
FIELD TYPE NULL KEY DEFAULT EXTRA
id int NO PRI NULL auto_increment

book_id int NO MUL NULL

member_id int NO MUL NULL

borrow_date date NO NULL

return_date date YES NULL

Page 8 of 23
SOURCE CODE

import mysql.connector

def create_connection():
connection = mysql.connector.connect(
host="localhost",
user="root",
password="1234567890",
database="library"
)
return connection

def create_tables(connection):
cursor = connection.cursor()

cursor.execute("""
CREATE TABLE IF NOT EXISTS books (
id INT AUTO_INCREMENT,
title VARCHAR(255) NOT NULL,
author VARCHAR(255) NOT NULL,
publication_date DATE NOT NULL,
PRIMARY KEY (id)
)
""")

cursor.execute("""
CREATE TABLE IF NOT EXISTS members (
id INT AUTO_INCREMENT,
name VARCHAR(255) NOT NULL,
email VARCHAR(255) NOT NULL,
phone_number VARCHAR(20) NOT NULL,

Page 9 of 23
password VARCHAR(255) NOT NULL,
PRIMARY KEY (id)
)
""")

cursor.execute("""
CREATE TABLE IF NOT EXISTS admins (
id INT AUTO_INCREMENT,
username VARCHAR(255) NOT NULL,
password VARCHAR(255) NOT NULL,
PRIMARY KEY (id)
)
""")

cursor.execute("""
CREATE TABLE IF NOT EXISTS borrowings (
id INT AUTO_INCREMENT,
book_id INT NOT NULL,
member_id INT NOT NULL,
borrow_date DATE NOT NULL,
return_date DATE,
PRIMARY KEY (id),
FOREIGN KEY (book_id) REFERENCES books(id),
FOREIGN KEY (member_id) REFERENCES members(id)
)
""")

connection.commit()

def login_member(connection, email, password):


cursor = connection.cursor()

Page 10 of 23
cursor.execute("SELECT * FROM members WHERE email = %s AND password =
%s", (email, password))
result = cursor.fetchone()
return result

def login_admin(connection, username, password):


cursor = connection.cursor()
cursor.execute("SELECT * FROM admins WHERE username = %s AND
password = %s", (username, password))
result = cursor.fetchone()
return result

def register_member(connection, name, email, phone_number, password):


cursor = connection.cursor()
cursor.execute("INSERT INTO members (name, email, phone_number, password)
VALUES (%s, %s, %s, %s)", (name, email, phone_number, password))
connection.commit()
print("Member registered successfully!")

def borrow_book(connection, book_id, member_id, borrow_date, return_date):


cursor = connection.cursor()
cursor.execute("INSERT INTO borrowings (book_id, member_id, borrow_date,
return_date) VALUES (%s, %s, %s, %s)", (book_id, member_id, borrow_date,
return_date))
connection.commit()
print("Book borrowed successfully!")

def return_book(connection, book_id):


cursor = connection.cursor()
cursor.execute("UPDATE borrowings SET return_date = CURDATE() WHERE
book_id = %s AND return_date IS NULL", (book_id,))
connection.commit()
print("Book returned successfully!")

Page 11 of 23
def search_book(connection, title):
cursor = connection.cursor()
cursor.execute("SELECT * FROM books WHERE title LIKE %s", ("%" + title +
"%",))
results = cursor.fetchall()
return results

def main():
connection = create_connection()
create_tables(connection)

while True:
print("Welcome to the Library Management System!")
print("1. Member Login")
print("2. Admin Login")
print("3. Register Member")
print("4. Exit")

choice = input("Enter your choice: ")

if choice == "1":
email = input("Enter your email: ")
password = input("Enter your password: ")
member = login_member(connection, email, password)
if member:
print("Login successful!")
while True:
print("Member Menu:")
print("1. Borrow a Book")
print("2. Return a Book")
print("3. Search for a Book")
print("4. Exit")

Page 12 of 23
choice = input("Enter your choice: ")

if choice == "1":
book_id = int(input("Enter book ID: "))
borrow_date = input("Enter borrow date (YYYY-MM-DD): ")
return_date = input("Enter return date (YYYY-MM-DD): ")
borrow_book(connection, book_id, member[0], borrow_date,
return_date)

elif choice == "2":


book_id = int(input("Enter book ID: "))
return_book(connection, book_id)

elif choice == "3":


title = input("Enter book title: ")
results = search_book(connection, title)
if results:
for result in results:
print(result)
else:
print("No books found with that title.")

elif choice == "4":


break

else:
print("Invalid choice. Please try again.")

else:
print("Invalid email or password. Please try again.")

Page 13 of 23
elif choice == "2":
username = input("Enter your username: ")
password = input("Enter your password: ")
admin = login_admin(connection, username, password)
if admin:
print("Login successful!")
while True:
print("Admin Menu:")
print("1. Add a Book")
print("2. Remove a Book")
print("3. View all Borrowings")
print("4. Exit")

choice = input("Enter your choice: ")

if choice == "1":
title = input("Enter book title: ")
author = input("Enter book author: ")
publication_date = input("Enter publication date (YYYY-MM-DD): ")
cursor = connection.cursor()
cursor.execute("INSERT INTO books (title, author, publication_date)
VALUES (%s, %s, %s)", (title, author, publication_date))
connection.commit()
print("Book added successfully!")

elif choice == "2":


book_id = int(input("Enter book ID: "))
cursor = connection.cursor()
cursor.execute("DELETE FROM books WHERE id = %s", (book_id,))
connection.commit()
print("Book removed successfully!")

Page 14 of 23
elif choice == "3":
cursor = connection.cursor()
cursor.execute("SELECT * FROM borrowings")

results = cursor.fetchall()
if results:
for result in results:
print(result)
else:
print("No borrowings found.")

elif choice == "4":


break

else:
print("Invalid choice. Please try again.")

else:
print("Invalid username or password. Please try again.")

elif choice == "3":


name = input("Enter your name: ")
email = input("Enter your email: ")
phone_number = input("Enter your phone number: ")
password = input("Enter your password: ")
register_member(connection, name, email, phone_number, password)

elif choice == "4":


break

else:
print("Invalid choice. Please try again.")

Page 15 of 23
if __name__ == "__main__":
main()

Page 16 of 23
OUTPUT
• MEMBERS MENU

Page 17 of 23
Page 18 of 23
• ADMINS MENU

Page 19 of 23
Page 20 of 23
• NEW USER REGISTRATION

Page 21 of 23
SOFTWARE REQUIREMENT

• Windows OS
• Python
• MySQL

Library Management download -


https://drive.google.com/file/d/11BUqyRto0dcq7HCpR3nYFO
tyg6aNydrD/view?usp=drive_link

Page 22 of 23
CREDITS
• Few suggestions from subject teacher, Mrs. Kiran Singh
• Computer science With Python - Class XII By : Sumita
Arora
• www.geeksforgeeks.org

Page 23 of 23

You might also like