TANAKPUR , CHAMPAWAT
TOPIC : LIBRARY MANAGEMENT SYSTEM
SESSION : 2022 - 2023
SUBMITTED TO: SUBMITTED BY:
Mrs. Kajol Singh Niketan Bhatt
This is to certify that LIBRARY
MANAGEMENT PROJECT
is successfully completed by
NIKETAN BHATT
of Class: 12th A
for the academic year 2022-2023.
Head Teacher :Mrs. Kajol
Examiner’s Signature:
Teacher In-Charge : Principal
Date : 28/10/2022
I, NIKETAN BHATT of class 12th A would like to
express my sincere gratitude to our computer
science teacher Mrs. Kajol , for her vital support,
guidance and encouragement to complete this
Library Management Project ,
without which this project would not have come
forth.
INDEX
• CERTIFICATE
1) • ACKNOWLEDGEMENT
• INTRODUCTION
• OBJECTIVE OF THE PROJECT
2) • PROPOSED SYSTEM
• MYSQL CODING
• PYTHON CODING
3) • SOFTWARE AND HARDWARE
REQUIREMENTS
• OUTPUT SCREENS
LIBRARY MANAGEMENT SYSTEM
INTRODUCTION :
The Library Management System is basically a database based project
done with help of python language . This project is very useful for the
librarians to keep a count on what project they have and how much they
sold or issue books.This project is multi-level project so that it can be
modified for various purposes.
OBJECTIVE OF THE PROJECT :
The objective of this project is to let the students apply the
programming knowledge into a real-world situation / problem
and exposed the students how programming skills helps in
developing a good software.
Write programs utilizing modern software tools.
Apply object oriented programming principles effectively
when developing small to medium sized projects.
Write effective procedural code to small to medium sized
problems.
Students will demonstrate a breadth to knowledge in
information practices , as exemplified in the areas of systems ,
theory and software development
Students will demonstrate ability to conduct a research or
applied informatics. Practices projects , required writing and
presentation skills which exemplify scholarly style in
information practices
PROPOSED SYSTEM :
Today one cannot afford to rely on the fallible human
beings of be really wants to stand againist today’s
merciless competition not to be wise saying ‘’ to err
human ‘’ no longer valid , it’s outdated to rationalize your
mistake. So, to keep pace with time, to bring about the
best result without malfunctioning and greater efficiency
so as to replace the unending heaps of flies with a much
sophisticated hard disk of the computer.
One has to use the data management software. Software
has been an ascent in atomization various organizations .
Many software products working are now in markets ,
which have helped ion making the organization work
easier and efficiently . Data Management had to initially
maintain a lot of ledgers and a lot of paper work has to
be done but now software product on this organization
has made their work faster and easier . Now only this
software has to be loaded on the computer and the
work can be done.
This prevents a lot of time and money. The works
becomes fully automated and any information regarding
the organization can be obtained by clicking the button.
Moreover ,now it’s an age of computers and
automatically such an organization gives a better look.
SOURCE CODE
MySQL
Database used : Library
Tables Used :
• BOOKS
• ISSUE
• SUBMIT
Table BOOKS:
Table ISSUE:
Table SUBMIT:
4
LIBRARY MANAGEMENT SYSTEM
This project is made using two python scripts
First ( MYSQL ) : coding for making tables in mysql server
We will write python code for making tables and database in
mysql server. We will use python mysql connectivity for this. After
writing the code we will execute this script only once. And after
executing all the tables and database will be created in the server.
Second ( PYTHON IDLE ) : coding for using project interface.
Now we have made our database in mysql server using python
idle. So now we will write the python code so that we can insert
and access data from our database. We will create several
functions for our interface of project. These functions will drive the
working of our project / system.
MYSQL
We will create a database “l1” and in that we will create 3 tables.
import mysql.connector as a
5
con=a.connect(host=‘localhost’ ,
user=‘root’ , passwd=‘1234’ ,
port=3306 ,
database=‘ library ’ ,
auth_plugin = ‘mysql_native_password’)
c = con.cursor()
c.execute(‘show databases’)
dl=c.fetchall()
f=false
for I in dl:
if ‘library’==i[0]:
sql=‘use l1’
c.execute(sql)
f=True
if f== False:
sql1 = "create database l1“
c.execute(sql1)
sql2 ="use l1“
c.execute(sql2)
sql3 = "create table books (bname varchar(50),bcode varchar(10),
total int , subject varchar(50))"
c.execute(sql3)
sql4 = "create table issue (sname varchar(50), regno varchar(10),
bcode varchar(10), idate varchar(10))“
c.execute(sql4)
sql5 = "create table submit (sname varchar(50), regno varchar(10),
bcode varchar(10), sdate varchar(10))"
c.execute(sql5)
con.commit()
6
PYTHON IDLE
import mysql.connector as a
con = a.connect
(host="localhost",user="root",passwd="1234",database=" library ",
port=3306, auth_plugin = ‘mysql_native_password’ )
def addbook():
bn = input("Enter BOOK Name : ")
c = input("Enter BOOK Code : ")
t = input("Total Books : ")
s = input("Enter Subject : ")
data = (bn,c,t,s)
sql = 'insert into books values(%s,%s,%s,%s)'
c = con.cursor()
c.execute(sql,data)
con.commit()
print(" ---’’’---’’’---“’
’’’---’’’—-’’’---’’’---”)
print("Data Entered Successfully")
7
main()
def issueb():
n = input("Enter Name : ")
r = input("Enter Reg No : ")
co = input("Enter Book Code : ")
d = input("Enter Date : ")
a = "insert into issue values(%s,%s,%s,%s)"
data = (n,r,co,d)
c = con.cursor()
c.execute(a,data)
con.commit()
print("---’’’---’’’---’’’---’’’---’’’---’’’---’’’---’’’---’’’---’’’---’’’---’’’---’’’--")
print("Book issued to : ",n)
bookup(co,-1)
def submitb():
8
n = input("Enter Name : ")
r = input("Enter Reg No : ")
co = input("Enter Book Code : ")
d = input("Enter Date : ")
a = "insert into submit values(%s,%s,%s,%s)"
data = (n,r,co,d)
c = con.cursor()
c.execute(a,data)
con.commit()
print("---’’’---’’’---’’’---’’’---’’’---’’’---’’’---’’’---’’’---’’’---’’’---’’’—”)
print("Book Submitted from : ",n)
bookup(co,1)
def bookup(co,u):
a = "select TOTAL from books where BCODE = %s"
data = (co,)
c = con.cursor()
9
c.execute(a,data) # (10,)
myresult = c.fetchone()
t = myresult[0] + u
sql = "update books set TOTAL = %s where BCODE = %s"
d = (t,co)
c.execute(sql,d)
con.commit()
main()
def rbook():
ac = input("Enter Book Code : ")
a = "delete from books where BCODE = %s"
data = (ac,)
c = con.cursor()
c.execute(a,data)
con.commit()
main()
def dispbook():
10
a = "select * from books"
c = con.cursor()
c.execute(a)
myresult = c.fetchall() # [(1,2,3,4),(1,2,3,4)]
for i in myresult:
print("Book Name : ",i[0])
print("Book Code : ",i[1])
print("Total : ",i[2])
print("Subject : ",i[3])
print("> <")
main()
def ibooks():
a = "select * from issue"
c = con.cursor()
c.execute(a)
myresult = c.fetchall() # [(1,2,3,4),(1,2,3,4)]
for i in myresult:
print("Student Name : ",i[0])
11
print("Reg No : ",i[1])
print("Book Code : ",i[2])
print("Issue Date : ",i[3])
print(“---’’’---’’’---’’’---’’’---’’’---")
main()
def main():
print("""
LIBRARY MANAGER
1. ADD BOOK
2. ISSUE BOOK
3. SUBMIT BOOK
4. DELETE BOOK
5. DISPLAY BOOKS
""")
choice = input("Enter Task No : ")
print(“---’’’---’’’---’’’---’’’---’’’---’’’---’’’---’’’---”)
if (choice == '1'):
addbook()
12
elif (choice=='2'):
issueb()
elif (choice=='3'):
submitb()
elif (choice=='4'):
rbook()
elif (choice=='5'):
print("1. All 2. Issued")
ch = input("Enter Task No. ")
print("---’’’---’’’---’’’---’’’---’’’---’’’---’’’---’’’---’’’---’’’—")
if ch == '1':
dispbook()
elif ch==‘2’:
ibooks()
else :
print(‘Wrong Choice………..’)
main()
13
def pswd():
ps = input("Enter Password : ") if
ps == "py143":
main()
else:
print("PASSWORD ERROR")
pswd()
pswd()
Software Requirements :
Mysql server : mysql server must be installed in computer.
It will be used for accessing data of project. Tables will be
made in server in which data will be stored.
Python idle : python idle must be installed in computer.
It will be used for executing python scripts.
mysql.connector : it will connect python idle with
mysql server. To install it open cmd and write pip install
mysql.connector
Hardware Requirements:
Computer must be of 500 gb hard-disk , intel i3
processor and 8 gb ram (minimum)
OUTPUT:
To Get Output : Press F5
On Entering Wrong Password :
When Password is Correct .
Adding a New Book using Python:
Let us check in MySQL table :
To Issue a Book in Library:
Let us check in MySQL tables :
In Issue Table record will be added.
Number of Books is Decreased By one.
To Submit a Book in Library:
Let us check in MySQL Tables:
In Submit Table , Record is Added.
Number of Books is Increased By one.
Displaying Number of Books in the Library:
Deleting a Book Name from Library:
Let us check in MySQL Tables:
Number of Books in Library is Decreased By one.