You are on page 1of 20

CENTRAL BOARD OF SECONDARY EDUCATION

The Emerald Heights International School

Informatics Practices Project


2019-2020

Topic: Library Management System

Submitted to – Mr. Ashirwad Mahalkari Submitted By – Akshat Totla XII P


1
ACKNOWLEDGEMENT

I am extremely thankful to our Principal Mr. Siddharth Singh


for providing me an opportunity to work on project titled
“Library Management System” and for giving me their
blessings and encouragement.
It is a matter of pride and pleasure to express my warm
gratitude to my teacher Mr. Ashirwad Mahalkari and the
computer staff for keen interest, unceasing resistance and
criticism at every stage of this project work.
I am also thankful to the C.B.S.E. for including the project
work in the syllabus.

2
CERTIFICATE
Session 2019-2020

This is to certify that Akshat Totla of class 12 P has prepared


the project entitled: ‘Library Management System’. This
project is the result of their hard work and endeavour. The
project is prepared under the guidance of the Informatics
Practices teacher and the IP Lab department.

Signature (Internal) Signature (Principal)

Signature (External)

3
INDEX OF CONTENT

 Introduction -5
 Front End -6
 Back End -7
 Source Code -9
 Conclusion -19
 Bibliography -20

4
Introduction

Library Management System can be used by education institutes to


maintain the records of books according to their categories and to
whom they are issued easily. Achieving this objective is difficult
using a manual system as the information is scattered, can be
redundant and collecting relevant information may be very time
consuming. All these problems are solved using this project.

Without a Library management System, managing and maintaining


the details of the book is a tedious job for any college. Library
Management System will store all the details of the books including
their category, availability and also maintains the details about the
students to whom the books are issued.

The software is designed and coded in Python 3.6.4 and database


management is done through MySQL 8.0. The main functionality of
the project is to:
 Display All Books
 Display Books Issued
 Search for Specific Book
 Issue and Return Book
 Add and Delete New Book

5
Front End

It is the user interface from where the data is collected. It has general
Python elements for effective input and display. Despite not having a
GUI, it still is very user-friendly and easy-to-use. It also is able to
provide faster processes due to simple yet effective algorithms,

Some important modules are:

 mysql.connector: MySQL Connector/Python enables Python


programs to access MySQL databases, using an Application
Programming Interface (API) that is compliant with the Python
Database
 Numpy: Numpy or Numerical Python is a module that
provides fast mathematical computations on Arrays and
Matrices.
 Pandas: Pandas is an open source library that provides
powerful tools for data analysis for Python programming.

Some important functions are:

 input(): This function the program flow will be stopped until the
user has given an input and has ended the input with the return
key.
 fetchall(): This function fetches all (or all remaining) rows of a
query result set and returns a list of tuples.
 execute(): This function is used for the dynamic execution of
the Python program which can either be a string or object code.
 commit(): This function sends a commit statement to the
MySQL server, committing the current transaction.

6
Back End

We have used a Database Management System (DBMS) where all the


data involved in the running of the Library Management software is
stored. It also stores all the data fed by the user.

Database Name: library


This was created and used by the following query:
create database library;
use library;

The database contains two tables which are as follows:

1. books: This table contains the data relating to books.


create table books ( BookID int(6) primary key,
Title varchar(50) NOT NULL,
Author varchar(50) NOT NULL,
Publisher varchar(30) NOT NULL,
Genre varchar(50) NOT NULL,
issued varchar(10) NOT NULL);

7
2. members: This table contains the details and information
needed for issuing and returning books.
create table members (MemberID int(6) primary key,
Name varchar(50) NOT NULL,
Class int(5) NOT NULL,
Section varchar(50) NOT NULL);

8
Source Code

1. Welcome Panel

import numpy
import pandas
import mysql.connector as connector

myconnection = connector.connect(host="localhost", user


="root", password = "root", database = "library")
mycursor = myconnection.cursor()
run = True

while run is True:


print("------------------Welcome to the Library Management
System ")

9
print ("1. Display All Books")
print ("2. Display All Issued Book ")
print ("3. Search Book")
print ("4. Issue Book")
print ("5. Return Book")
print ("6. Add New Book Record")
print ("7. Delete Book Record")
print ("8. Exit")
choice = int(input("Enter your choice: "))

2. Display All Books

if choice == 1: #display all books


mycursor.execute("select * from books")
a1 = mycursor.fetchall()
pp1 = pandas.DataFrame(a1,
columns=['BookID','Title','Author','Publisher','Genre','Issued'])
print(pp1)

10
3. Display All Issued Books:

elif choice == 2: #display issued books


mycursor.execute("select * from books where issued =
'yes'")
a2 = mycursor.fetchall()
pp2 = pandas.DataFrame(a2, columns=['BookID', 'Title',
'Author', 'Publisher', 'Genre', 'Issued'])
print(pp2)

4. Search Book:

elif choice == 3: #search book


print("1. Search by Book ID")
print("2. Search by Book Name")
print("3. Search by Book Author")
11
print("4. Search by Book Genre")
searchtype = int(input("Enter choice: "))
keyword = input("Enter the keyword: ")

a) Search by Book ID:

if searchtype == 1:
mycursor.execute(("select * from books
where BookID = {} ").format(keyword))
s1 = mycursor.fetchall()
pp3 = pandas.DataFrame(s1,
columns=['BookID', 'Title', 'Author',
'Publisher', 'Genre', 'Issued'])
print(pp3)

b) Search by Book Name:

12
elif searchtype == 2:
mycursor.execute(("select * from books where
Title like '%{}%'").format(keyword))
s2 = mycursor.fetchall()
pp4 = pandas.DataFrame(s2,
columns=['BookID', 'Title',
'Author', 'Publisher', 'Genre', 'Issued'])
print(pp4)

c) Search by Book Author:

elif searchtype == 3:
mycursor.execute(("select * from books where
Author like '%{}%' ").format(keyword))
s3 = mycursor.fetchall()
pp5 = pandas.DataFrame(s3,
columns=['BookID', 'Title', 'Author', 'Publisher',
'Genre', 'Issued'])
print(pp5)

13
d) Search by Book Genre:

elif searchtype == 4:
mycursor.execute(("select * from books where Genre
like '%{}%'").format(keyword))
s4 = mycursor.fetchall()
pp6 = pandas.DataFrame(s4, columns=['BookID',
'Title', 'Author', 'Publisher', 'Genre', 'Issued'])
print(pp6)

else:
print ("Invalid Choice")

14
5. Issue Book:

elif choice == 4: #issue book


memberid = int(input("Enter Member ID"))
name = input("Enter Name")
sclass = int(input("Enter class"))
section = input("Enter section")
ibook = int(input("Enter BookID for book to be issued"))
mycursor.execute(("insert into members values ({},'{}',
{},'{}');").format(memberid, name, sclass, section))
mycursor.execute(("update books set issued = 'yes' where
BookID = {};").format(ibook))
myconnection.commit()
print("Book Successfully Issued")

15
6. Return Book:

elif choice == 5: #return book


rmid = int(input("Enter Member ID"))
#rname = input("Enter Name of the Book")
rbid = int(input("Enter BookID of the book to be returned"))
mycursor.execute(("update books set issued = 'no' where BookID
={}").format(rbid))
mycursor.execute(("delete from members where MemberID = {}
").format(rmid))
myconnection.commit()
print("Book Returned Successfully")

7. Add New Book Record:

16
elif choice == 6: #add new book
nbid = int(input("Enter BookID"))
ntitle = input("Enter Book Name")
nauthor = input("Enter author name")
npublisher = input("Enter publisher name")
ngenre = input("Enter genre")
nissued = 'no'
mycursor.execute(("insert into books values
({},'{}','{}','{}','{}','{}')").format(nbid,
ntitle,nauthor,npublisher,ngenre, nissued))
myconnection.commit()
print("Book Added Successfully")

8. Delete Book Record:

elif choice == 7: #remove book


delbid = int(input("Enter BookID of the book to be deleted"))
mycursor.execute(("delete from books where BookID =
{}").format(delbid))

17
myconnection.commit()
print("Book Deleted Successfully")

9. Exit:

elif choice == 8:
print ("Thank you for using Library Management System!")
run = False
else:
print("Invalid Choice")

myconnection.disconnect()

18
Conclusion
Present Scope:
Library Management System can help transform libraries full of
written paper diaries and registers to smart, digital libraries where the
librarian can do almost all tasks using this software. Library
Management System leads to a better organization structure since the
information management of the all the available books is well-
structured and also leads to better as well as efficient utilization of
resources.
The project would surely help save time and efforts while making
institutes smart and digital.

Future Scope:
In future, this project can be enhanced to work for public libraries
which require both – user and admin – ends to work simultaneously.
Extra and user defined security needs can be employed during request
and response. Also, records of students and admin activities can be
maintained and another enhancement would be to add more modules
like online library, course allocation to cover all information off the
system. Furthermore, a release of API version can be planned so the
system can be integrated with other third-party applications which
will enhance the document management within other applications.
With more improvement, Library Management System will become a
professional-like software and further updates will make it even
better.

19
Bibliography

 Informatics Practices – Class 12 by Sumita Arora

 https://www.educative.io/courses/grokking-the-object-oriented-
design-interview/RMlM3NgjAyR

 https://dev.mysql.com/doc/refman/8.0/en/tutorial.html

 https://www.w3schools.com/python/

 https://www.geeksforgeeks.org/functions-in-python/

20

You might also like