0% found this document useful (0 votes)
10 views19 pages

LIBRARY MANAGEMENT MMV

Uploaded by

vivan14valo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views19 pages

LIBRARY MANAGEMENT MMV

Uploaded by

vivan14valo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 19

AIM

The aim of this project is to create an advanced Library Management


System that revolutionizes traditional library operations. Through the
implementation of Python, the project targets a significant reduction
in manual workload, minimizing errors, and ultimately enhancing
overall efficiency. This system not only saves time but also ensures
cost-effective library management, as it eliminates the need for
extensive manual labour.

The system facilitates detailed records for an unlimited number of


students, enhancing the library's capacity to manage student
information efficiently. Real-time information on available books
speeds up the issue and return processes, significantly reducing
transaction times. This project also addresses the pressing issues of
paperwork and manpower in traditional library management.

Automation of book availability and student records substantially


reduces reliance on manual labour, fostering a sustainable and
efficient approach to library operations. The project aligns with
contemporary technological advancements, reflecting a commitment
to reducing environmental impact through decreased paper usage
and promoting cost-effective practices. The integration of these
features ultimately establishes a user-friendly platform for librarians,
optimizing their workflow, and creating a more efficient borrowing
experience for students. The ultimate goal is to contribute to a more
modern, error-free, and economically viable approach to library
administration.
MODULES USED
pandas - Pandas is a Python's data analysis library that provides data
structures and functions for data manipulation and analysis.

matplotlib - Matplotlib is a Python library that provides many


interfaces and functionality for 2D graphics in various forms.

mysql.connector - It is a library that connects MySQL databases from


within the python
FUNCTIONS USED
cursor: A database cursor is a useful control structure of database
connectivity. Normally when you connect to a database from within
a script/program, then the query gets sent to the server, where it
gets executed, and the results is sent over the connection to you, in
one burst of action

connect(): This function establishes connection between Python and


MySQL

fetchall():This function will return all the rows from the result set in
the form of a tuple containing the records.

commit(): This function provides changes in the database physically.

def():A function is a block of code which only runs when it is called.

execute(): This function is used to execute the sql query and retrieve
records using python.
MATPLOTLIB FUNCTIONS

bar(): It is used to create and plot a bar chart

title(): it is used to add a title to your plot.

xticks(): function used to set and get current tick locations and labels
of x axis.

xlabel(): function used to set labels for the x axis.

ylabel(): it is used to set labels for the y axis.

xlabel():It is used to set labels for the x axis.

ylabel(): It is used to set labels for the y axis.

title(): It is used to add a title to the plot.

show(): It is used to show a plot as per the given specifications


USER DEFINED FUNCTIONS
Login() - This function helps the library staff to login by providing the correct
username and password

Homepage() - This function helps to view the various functions which the
library staff
can use .

addbook() - This function helps the library staff to easily add new books to the
database

deletebook() - Books that are no longer in circulation can be removed from the
database using the book's ID through this function.

addstudent() - This function helps the library staff to easily add new students
to the database by providing their name, standard, sec, phoneno, roll no and
sex.

updatestudent() - This function helps the library staff to easily update specific
details of an exiting student.

issuebook() - Library staff can record the issue of book by providing the book's
ID and the student ID and the date of issue

returnbook() - Library staff can record the issue of book by providing the
book's ID and the student ID and the date of return

report() - This function is used to see and visualize various reports on


information which might be useful to take future decisions by the library staff.
DATABASE/
TABLES
PROJECT
CODE
import mysql.connector as sqltor
import pandas as pd
import matplotlib.pyplot as plt
mycon=sqltor.connect(host='localhost',user='root',password='ro
ot',database='smartlibrary')
mycursor=mycon.cursor()
#Definition for adding books details
def addbook():
mycon =
sqltor.connect(host='localhost',user='root' ,password='root',d
atabase= 'smartlibrary')
mycursor=mycon.cursor()
bookid=int(input('ENTER BOOK ID :'))
title = input('ENTER BOOK TITLE: ')
author = input('ENTER AUTHORS NAME: ')
publisher = input('ENTER PUBLISHERS NAME:' )
edition = input('ENTER THE EDITION NUMBER: ')
available = input('ENTER BOOK AVAILABILITY : ')
price = input('ENTER THE PRICE: ')
data =
(bookid,title,author,publisher,edition,available,price)
sql = 'insert into book values(%s,%s,%s,%s,%s,%s,
%s);'
mycursor. execute(sql,data)
mycon.commit
print("BOOK DETAILS ADDED SUCCESSFULLY")
mycon.close()
Homepage()

#Definition for deleting book details


def deletebook():
mycon =
sqltor.connect(host='localhost' ,user='root', password='root',
database='smartlibrary')
mycursor=mycon.cursor()
bookid = input('ENTER BOOK ID TO BE DELETED :')
sql = "delete from book where
bookid='{}'".format(bookid)
mycursor.execute(sql)
mycon.commit()
print('BOOK DETAILS DELETED SUCCESSFULLY')
mycon.close()
Homepage()

#Definition for adding student details


def addstudent():

mycon=sqltor.connect(host='localhost',user='root',password='ro
ot',database='smartlibrary')
mycursor=mycon.cursor()
studentid = int(input("ENTER STUDENTID : "))

sname = input('ENTER STUDENT NAME :')


standard = input('ENTER STANDARD:')
sec = input('ENTER SECTION :')
phoneno = input('ENTER PARENT PHONE NUMBER : ')
rollno = input('ENTER ROLL NO :')
sex = input('ENTER SEX :')
data = (studentid,sname,standard,sec,phoneno,
rollno, sex)
sql = 'insert into student values(%s,%s,%s,%s,%s,
%s,%s);'
mycursor. execute(sql,data)
mycon.commit()
print('STUDENT DETAILS ADDED SUCCESSFULLY')
mycon.close()
Homepage()

#Definition for updating student details


def updatestudent():
mycon =
sqltor.connect(host='localhost',user='root',password='root',da
tabase='smartlibrary')
mycursor=mycon.cursor()
print(' 1.STUDENT NAME')
print('2.STANDARD')
print("3. SECTION: ")
print('4. PARENT PHONE NUMNER')
print('5.ROLL NO')
print('6.SEX')
z=int(input('ENTER THE CHOICE: '))
value=""
if z==1:
value='sname'
elif z==2:
value='standard'
elif z==3:
value='sec'
elif z==4:
value='phoneno'
elif z==5:
value='rollno'
elif z==6:
value='sex'
sid = input('ENTER STUDENT ID :')
new= input('ENTER NEW VALUE :')

sql='update student set ' + value + '= "'+ new + '"


where studentid = ' + sid +';'
mycursor. execute(sql)
mycon.commit()
print('STUDENT DETAILS UPDATED SUCCESSFULLY')

mycon.close()
Homepage()

#Definition for issuing books


def issuebook():
mycon = sqltor.
connect(host="localhost",user='root',
password='root',database='smartlibrary')
mycursor=mycon.cursor()
tid=int(input('ENTER THE TRANSACTION ID :'))
bookid = input('ENTER BOOK ID :')
studentid=input('ENTER STUDENT ID:')
doi = input("ENTER THE DATE OF ISSUE YYYY-MM-DD:")
data = (tid,bookid,studentid,doi)
sql = 'insert into
transactions(tid,bookid,studentid,doi) values(%s,%s,%s,%s);'
mycursor.execute(sql,data)
mycon.commit()
print('ISSUE OF BOOK RECORDED SUCCESSFULLY')
mycon.close()
Homepage()

#Definition for returning books


def returnbook():
mycon = sqltor.connect(host='localhost',
user='root',password='root',database='smartlibrary')
mycursor=mycon.cursor()
tid=int(input('ENTER TRANSACTION ID:'))
bookid = input('ENTER BOOK ID:')
studentid = input('ENTER STUDENT ID :')
dor = input('ENTER THE DATE OF RETURN YYYY-MM-DD:')
data = (tid,bookid,studentid,dor)
sql = 'insert into transactions (tid, bookid,
studentid,dor) values(%s,%s,%s,%s);'
mycursor.execute(sql,data)
sql = "update book set available='Y' where bookid="''.
format(bookid)
mycursor.execute(sql)
mycon.commit
print('RETURN OF BOOK RECORDED SUCCESSFULLY')
mycon.close()
Homepage()
#Definition for report
def report():
mycon =
sqltor.connect(host='localhost',user='root',password='root' ,d
atabase='smartlibrary')
mycursor=mycon.cursor()
print()
print('1.LIST OF AVAILABLE BOOKS IN LIBRARY')
print('2.LIST OF BOOKS LENT TO STUDENTS')
print('3.BARCHART SHOWING BOOKS AVAILABLE VS BOOKS LENT')
print()
x=int(input('ENTER THE CHOICE :'))
if x==1:
listavbooks="Select * from book where
available='Yes';"
mycursor.execute(listavbooks)
myrecord=mycursor.fetchall()
for y in myrecord:
print(y)
mycon.close()
if x==2:
listnavbooks="Select * from book where
available='No';"
mycursor.execute(listnavbooks)
myrecord=mycursor.fetchall()
for y in myrecord:
print(y)
mycon.close()
if x==3:
df=pd.read_sql("select available,count(*)count from
book group by available;",mycon)
xval=df['available']
yval=df['count']
plt.bar(xval,yval)
plt.xlabel("Availability of Books")
plt.ylabel("Number of Books")
plt.title("Books Available vs Lent")
plt. show()
mycon.close()
Homepage()
Login()
def Homepage():
print('-'*20)
print('-'*5,'welcome to smart library','-'*5)
print('-'*20)
print('1.ADD BOOK DETAILS')
print('2.DELETE BOOK DETAILS')
print('3.ADD STUDENT DETAILS')
print('4.UPDATE STUDENT DETAILS')
print('5.ISSUE OF BOOK')

print('6.RETURN OF BOOK')
print('7.REPORT')
print()
x=int(input("ENTER THE CHOICE:"))
if x==1:
addbook()
elif x==2:
deletebook()
elif x==3:
addstudent()
elif x==4:
updatestudent()
elif x==5:
issuebook()
elif x==6:
returnbook()
elif x==7:
report()
else:
print('INVALID CHOICE')
#Definition for Login
def Login():
print("*_*_*_*_*__*_*_*_*_*_*")
print("WELCOME TO SMART LIBRARY")
print('*_**_***.*_*_*_*_*_*_*')
user=input('Enter username :')
pas=input('Enter password :')
if user=='Admin' and pas == 'brv':
print('SUCCESSFULLY LOGGED IN')
Homepage()
else:
print("INCORRECT CREDENTIALS")
Login()
Login()
SAMPLE
OUTPUT
SUGGESTED IMPROVEMENTS
Additional functionality of fine collection and calculation can be
added in the future. This will help automatically calculate fines for
overdue books based on a predefined due period. Fine to be charged
can be displayed to the librarian when a book is returned to the
library.

We can also limit the maximum number of books a student can


borrow at any given point of time to a specified limit by adding
additional functionality for the same.

Various other graphs like histogram, trend chart, scatter plot and
other tools of analysis can be used by the librarian to take better
decisions in the future regarding new books to be ordered.
CONCLUSION

This project was completed on time and is found working effectively


under all circumstances that may arise in the real environment.

Using the facilities and functionalities of python and MySQL, the


program has been developed in a neat manner. This program is
simple and user friendly the speed and accuracy is maintained in a
proper way. Testing of the program has given good results.

The program is done with an insight into necessary modifications


that are required in the future.
BIBLIOGRAPHY

1.Textbook for class 12 Informatics Practices- NCERT

2. Textbook for class 11 Informatics Practices- NCERT

3.Informatics Practices Class 12-Preeti Arora

4.Informatics Practices Class 12- Sumita Arora

You might also like