Cs Project
Cs Project
VIDYALAYA
MACHILIPATNAM
COMPUTER SCIENCE
INVESTIGATORY PROJECT
LIBRARY MANAGEMENT SYSTEM
PROJECT REPORT
Prepared By:
SUBMITTED TO:
REVALLA VIJAYA KUMAR
PGT (COMPUTER SCIENCE)
PMSHRI KENDRIYAVIDYALAYA
MACHILIPATNAM
CERTIFICATE
This is to certify that GUNJA
RAMANA of
Class XII has done her Project on
“LIBRARY MANAGEMENT ”
Under my supervision. She has
taken
Interest and has shown at most
sincerity in completion of this
project.
I certify that this Project is up to
my Expectation & as per
guidelines issued by CBSE.
ACKNOWLEDGME
NT
It is with pleasure that I acknowledge
my sincere gratitude to our teacher
Mr. Revalla Vijaya Kumar, who taught
and under took the responsibility of
teaching the subject computer
science, I have been greatly
benefited from his classes. My
sincere thanks to our Principal
Mohammed Asif Hussain Sir who
has always been a source of
encouragement and support and
without whose inspiration this project
would not have been a success.
Finally, I would like to express my
sincere thanks to all my friends for
the fine times that we all shared
together. Last but not least, I would
like to thank all those who had
helped directly or indirectly towards
the completion of this project.
CONTENTS
S.NO. TITLE
1. INTRODUCTION
2. ANALYSIS: -
A) SCOPE OF PROJECT
3. SYSTEM DESIGN :-
A) MODULE SPECIFICATION
4. STEPS INVOLVED
5. PACKAGES USED
8. OUTPUT SCREENS
9. ADVANTAGES
10. CONCLUSION
11. BIBLIOGRAPHY
INTRO
DUCTI
ON
This project first reads the data in the excel file with
the help of xlrd and then exports the data to the
mysql database directly with the help of the data
available. we can categorise the books according to
the our needs i.e stream wise, class wise and subject
wise. This software helps the librarian in while
issueing the books ..the name of the student who
has taken the book will be recorded and then while
the person is returning the book .The Libararian can
know the details of the penality and number of days
he/she has kept the book along with him/her.It also
takes the input of the new book details which can be
added to the mysql database which further helps to
store the data of all the books available in the library
including with the new books which are added later.
ANALYSIS
A) SCOPE OF PROJECT:
1.Functionality:
The functionality requirement specifies which
output should be produced from the given input.
In “LIBRARY MANAGEMENT SYSTEM” project, it
just requires the excel file .
2. Performance:
The code performs very well when there is proper
RAM available, it also requires internet connection
to download the necessary libraries, latest version
of python 3 is preferred, There must be MYSQL
database software in the computer
3. External interface:
PACKAGES USED
There are the following library functions which are used
in this program. The uses of these functions are also
given below:
MYSQL.CONNECTOR
Make sure to install mysql.connector package before
running the code. You can do that by going to
command prompt and then typing pip install mysql-
connector
Mysql.connector is a driver software which connects
mysql database to python program. In this project it
plays a key role, it stores the details of students, their
marks and details like to which stream they belong to
and etc. .
XLRD
Make sure to install xlsx reader package before running
the code. You can do that by going to command prompt
and then typing pip install xlrd
It is a package which is used to make link between
python and xlsx file, It gives various features to write in
excel sheet along with lots of font styles.
File handling functions
File handling function are used in this project to read
data for main text file and then modifying it as per out
requirement
Functions used:
● read()
● readlines()
● write()
Here xlrd is also used to read data in excel sheet and to
export in the mysql table.
CODE
from xlrd import open_workbook
import mysql.connector as mq
from tabulate import tabulate
def menu():
print("\t\t\t\t\tLIBRARY MANAGEMENT SYSTEM")
print("\t\t\t\t\t=========================")
print("\t\t\t\t\t\tMAIN MENU")
print("\t\t\t\t\t\t*********")
print("\t\t\t1.Category search \t 2.Search book \t\n")
print("\t\t\t3.Lend book \t 4.Returning a book and penality details \t\n")
print("\t\t\t5.Add a new book \t 6.Reset Database\n")
print("\t\t\t7.Exit \t\n")
def categorysearch():
print("\n\t\t1.Class wise search 2.Subject wise search 3.Stream wise search\n")
a=int(input("\t\tSelect your category:"))
if (a==1):
b=int(input("\t\t\nEnter which class books you want to search:"))
if b==11:
print("\n11th class books:")
print("=================")
con=mq.connect(host="localhost",user="root",passwd="root",database="library")
cur=con.cursor()
query="select*from books where class=11"
cur.execute(query)
res=cur.fetchall()
print("\nclas stream subject Book name stunam DOI DOR")
print(tabulate(res))
elif b==12:
print("\n12th class books...")
print("===================")
con=mq.connect(host="localhost",user="root",passwd="root",database="library")
cur=con.cursor()
query="select*from books where class=12"
cur.execute(query)
res=cur.fetchall()
print("\nclas stream subject Book name stunam DOI DOR")
print(tabulate(res))
else:
print("Please enter valid class(11/12)\n")
elif(a==2):
print("\n\t\t\t1.English \t\t\t 2.Chemistry \t\n")
print("\t\t\t3.Physics \t\t\t 4.Mathematics \t\n")
print("\t\t\t5.Hindi \t\t\t 6.Biology \t\n")
print("\t\t\t7.Accounts \t\t\t 8.Buisness \t\n")
print("\t\t\t9.Geography\t\t\t 10.Political Science \t\n")
print("\t\t\t11.History \t\t\t 12.Economics \t\n")
print("\t\t\t13.Computer Science \t\t\t 14.Sanskrit \t\n")
c=int(input("\t\tSelect which subject books you want to search from the above subjects:"))
if(c==1):
print("\n\t\tenglish books...")
print("\t\t****************")
con=mq.connect(host="localhost",user="root",passwd="root",database="library")
cur=con.cursor()
query="select*from books where subject='english'"
cur.execute(query)
res=cur.fetchall()
if res==[]:
print("This subject books are currently not available in our library")
else:
print("\ncls strm subject Book name Stunam DOI DOR")
print(tabulate(res))
elif(c==2):
print("\n\t\tChemistry books...")
print("\t\t------------------")
con=mq.connect(host="localhost",user="root",passwd="root",database="library")
cur=con.cursor()
query="select*from books where subject='chemistry'"
cur.execute(query)
res=cur.fetchall()
print("\ncls stream subject Book name STUNAM DOI DOR")
print(tabulate(res))
elif(c==3):
print("\n\t\tPhysics books...")
print("\t\t================")
con=mq.connect(host="localhost",user="root",passwd="root",database="library")
cur=con.cursor()
query="select*from books where subject='physics'"
cur.execute(query)
res=cur.fetchall()
if res==[]:
print("This subject books are currently not available in our library")
else:
print("\ncls stream subject Book name STUNAM DOI DOR")
print(tabulate(res))
elif(c==4):
print("\n\t\tMathematics books..")
print("\t\t-------------------")
con=mq.connect(host="localhost",user="root",passwd="root",database="library")
cur=con.cursor()
query="select*from books where subject='Mathematics'"
cur.execute(query)
res=cur.fetchall()
if res==[]:
print("This subject books are currently not available in our library")
else:
print("\ncls stream subject Book name STUNAM DOI DOR")
print(tabulate(res))
elif(c==5):
print("\n\t\tHindi books")
print("\t\t***********")
con=mq.connect(host="localhost",user="root",passwd="root",database="library")
cur=con.cursor()
query="select*from books where subject='Hindi'"
cur.execute(query)
res=cur.fetchall()
if res==[]:
print("This subject books are currently not available in our library")
else:
print("\ncls strm subject Book name STUNAM DOI DOR")
print(tabulate(res))
elif(c==6):
print("\n\t\tBiology books...")
print("\t\t****************")
con=mq.connect(host="localhost",user="root",passwd="root",database="library")
cur=con.cursor()
query="select*from books where subject='Biology'"
cur.execute(query)
res=cur.fetchall()
if res==[]:
print("This subject books are currently not available in our library")
else:
print("\ncls stream subject Book name stunam DOI DOR")
print(tabulate(res))
elif(c==7):
print("\n\t\tAccounts books...")
print("\t\t*******************")
con=mq.connect(host="localhost",user="root",passwd="root",database="library")
cur=con.cursor()
query="select*from books where subject='Accounts'"
cur.execute(query)
res=cur.fetchall()
if res==[]:
print("This subject books are currently not available in our library")
else:
print("\ncls stream subject Book name stunam DOI DOR")
print(tabulate(res))
elif(c==8):
print("\n\t\tBuisness books..")
print("\t\t==================")
con=mq.connect(host="localhost",user="root",passwd="root",database="library")
cur=con.cursor()
query="select*from books where subject='Business'"
cur.execute(query)
res=cur.fetchall()
if res==[]:
print("This subject books are currently not available in our library")
else:
print("\ncls stream subject Book name STUNAM DOI DOR")
print(tabulate(res))
elif(c==9):
print("\n\t\tGeography books...")
print("\t\t-------------------")
con=mq.connect(host="localhost",user="root",passwd="root",database="library")
cur=con.cursor()
query="select*from books where subject='Geography'"
cur.execute(query)
res=cur.fetchall()
if res==[]:
print("This subject books are currently not available in our library")
else:
print("\ncls stream subject Book name STUNAM DOI DOR")
print(tabulate(res))
elif(c==10):
print("\n\t\tPolitical Science books...")
print("\t\t**************************")
con=mq.connect(host="localhost",user="root",passwd="root",database="library")
cur=con.cursor()
query="select*from books where subject='Political science'"
cur.execute(query)
res=cur.fetchall()
if res==[]:
print("This subject books are currently not available in our library")
else:
print("\ncls stream subject Book name STUNAM DOI DOR")
print(tabulate(res))
elif(c==11):
print("\n\t\tHistory books..")
print("\t\t=================")
con=mq.connect(host="localhost",user="root",passwd="root",database="library")
cur=con.cursor()
query="select*from books where subject='History'"
cur.execute(query)
res=cur.fetchall()
if res==[]:
print("This subject books are currently not available in our library")
else:
print("\ncls stream subject Book name STUNAM DOI DOR ")
print(tabulate(res))
elif(c==12):
print("\n\t\tEconmics books..")
print("\t\t------------------")
con=mq.connect(host="localhost",user="root",passwd="root",database="library")
cur=con.cursor()
query="select*from books where subject='Economics'"
cur.execute(query)
res=cur.fetchall()
if res==[]:
print("This subject books are currently not available in our library")
else:
print("\nclass stream subject Book name STUNAM DOI DOR")
print(tabulate(res))
elif(c==13):
print("\n\t\tComputer Science books...")
print("\t\t**************************")
con=mq.connect(host="localhost",user="root",passwd="root",database="library")
cur=con.cursor()
query="select*from books where subject='Computer science'"
cur.execute(query)
res=cur.fetchall()
if res==[]:
print("This subject books are currently not available in our library")
else:
print("\ncls stream subject Book name STUNAM DOI DOR")
print(tabulate(res))
elif(c==14):
print("\n\t\tSanskrit books...")
print("\t\t-------------------")
con=mq.connect(host="localhost",user="root",passwd="root",database="library")
cur=con.cursor()
query="select*from books where subject='sanskrit'"
cur.execute(query)
res=cur.fetchall()
if res==[]:
print("This subject books are currently not available in our library")
else:
print("\ncls stream subject Book name STUNAM DOI DOR")
print(tabulate(res))
else:
print("Enter the valid number\n")
elif(a==3):
print("\n\t\t1.Science stream \t\t\t 2.Humanities stream \t\n")
print("\t\t3.Commerce stream\n")
d=int(input("Enter your stream :"))
if d==1:
print("\nscience stream books")
print("********************")
con=mq.connect(host="localhost",user="root",passwd="root",database="library")
cur=con.cursor()
query="select*from books where stream='science'"
cur.execute(query)
res=cur.fetchall()
if res==[]:
print("This stream books are currently not available in our library")
else:
print("\ncls stream subject Book name STUNAM DOI DOR")
print(tabulate(res))
if d==2:
print("\nHumanities stream books")
print("=========================")
con=mq.connect(host="localhost",user="root",passwd="root",database="library")
cur=con.cursor()
query="select*from books where stream='Humanities' or 'Humanities/Commerce'"
cur.execute(query)
res=cur.fetchall()
if res==[]:
print("This stream books are currently not available in our library")
else:
print("\ncls stream subject Book name STUNAM DOI DOR")
print(tabulate(res))
if d==3:
print("\nCommerce stream books")
print("-----------------------")
con=mq.connect(host="localhost",user="root",passwd="root",database="library")
cur=con.cursor()
query="select*from books where stream='Commerce' or 'Humanities/Commerce'"
cur.execute(query)
res=cur.fetchall()
if res==[]:
print("This stream books are currently not available in our library")
else:
print("\ncls stream subject Book name STUNAM DOI DOR")
print(tabulate(res))
else:
print("Enter valid option number\n")
def searchbook():
print("searching your book...\n")
book=input("Enter the book you want to search:")
con=mq.connect(host="localhost",user="root",passwd="root",database="library")
cur=con.cursor()
query="select*from books where bookname='{}'".format(book)
cur.execute(query)
res=cur.fetchall()
if res==[]:
print("Book is not available in our library...")
else:
print("\ncls stream subject book name Stunam DOI DOR")
print(tabulate(res))
con.close()
def lendbook():
print("\nlending book to a student...")
le=input("\nEnter the book name you want to lend:")
con=mq.connect(host="localhost",user="root",passwd="root",database="library")
cur=con.cursor()
query="select*from books where bookname='{}'and date_of_issueing='null'".format(le)
cur.execute(query)
res=cur.fetchall()
if res==[]:
print("\nBook has been already taken by somebody...sorry!!")
else:
q=input("Enter the name of the student who has issued the book:")
t=input("Enter the date when the book has been issued:")
def returningandpenality():
import mysql.connector as mq
from datetime import date
con=mq.connect(host="localhost",user="root",passwd="root",database="library")
cur=con.cursor()
k=input("\nEnter the name of the book you are returning:")
import datetime
today = datetime.date.today()
someday = datetime.date(2020,7,31)
diff = today-someday
print("The Book was there with student for",diff.days,"days")
query="update books set date_of_returning='{}'where bookname='{}'".format(today,k)
cur.execute(query)
con.commit()
con.close
def newbook():
print("\nTaking the new book details...")
c=input("\nEnter the class of the new book:")
st=input("\nEnter the stream of the new book:")
sb=input("\nEnter the subject of new book:")
bo=input("\nEnter the name of the book name:")
import mysql.connector as mq
con=mq.connect(host="localhost",user="root",passwd="root",database="library")
cur=con.cursor()
query="insert into books(class,stream,subject,bookname)values({},'{}','{}','{}')".format(c,st,sb,bo)
cur.execute(query)
con.commit()
print("\nsuccessfully registered the new book details...")
con.close
def export():
con=mq.connect(host="localhost",user="root",passwd="root",database="library")
cur=con.cursor()
wb=open_workbook("book.xlsx")
s=wb.sheet_by_index(0)
for k in range(1,5000):
try:
d=[s.cell(k,0).value,s.cell(k,1).value,s.cell(k,2).value,s.cell(k,3).value,s.cell(k,4).value,s.cell(k,5).val
ue,s.cell(k,6).value]
query="insert into books values ({},'{}','{}','{}','{}','{}','{}')".format(d[0],d[1],d[2],d[3],d[4],d[5],d[6])
cur.execute(query)
con.commit()
except:
break
con.close()
def reset():
con=mq.connect(host="localhost",user="root",passwd="root",database="library")
cur=con.cursor()
k=input("Are you sure to Reset Database YES/NO: ")
if k.upper()=='YES':
query="delete from books"
cur.execute(query)
con.commit()
print('Succesfully Cleared all records from database')
con.close()
input()
while (1):
menu()
export()
n=int(input("\t\tEnter your choice:"))
if(n==1):
categorysearch()
elif(n==2):
searchbook()
elif(n==3):
lendbook()
elif(n==4):
returningandpenality()
elif(n==5):
newbook()
elif n==6:
reset()
elif n==7:
exit()
OUTPUT SCREENS
Advantages:
1) Saves time of librarian.
2) This software reduces paper work.
3) It is easy to analyse the students who has taken the book and not yet returned and
calculates the penalty.
Future Enhancement :
1. Make the code look more simplified.
2. Make the look more attractive and understandable.
CONCLUSION
This software is efficient in managing the library . This software also reduces the
work load of the librarians.
BIBLIOGRAPHY
SITES REFFERED
https://xlsxreader.readthedocs.io/
END