Library Management System Using Python and My SQL
Library Management System Using Python and My SQL
LIBRARY
MANAGEMENT
SYSTEM
Using Python and mySQL
Submitted By
May- 2023
CERTIFICATE
This is to certify that the project work entitled ‘LIBRARY MANAGEMENT SYSTEM
USING PYTHON AND MY SQL xxxxxx’ is a bonafide work being SUSIL KUMAR
SAHU and PRABHUPADA NAYAK bearing Registration No. #2101287387 and
Registration No. #2101287366 of B. Tech CSIT branch.
This project report is submitted in partial fulfillment for the requirement of the B.Tech degree
under Gandhi Institute of Technological Advancement (GITA), Bhubaneswar, Odisha.
Acknowledgem
ent
I would like to take this opportunity to thank all those individuals whose invaluable
contribution in a direct or indirect manner has gone into the making of this mini project a
tremendous learning experience for me.
I give my sincere thanks to Prof./Dr. xyz, Project Coordinator and Dr. Parimal Kumar Giri,
HOD CSIT for giving me the opportunity and motivating me to complete the project within
stipulated period of time and providing a helping environment.
I acknowledge with immense pleasure the sustained interest, encouraging attitude and
constant inspiration rendered by Prof. (Dr.) M.K. Roul (Principal), GITA Autonomous.
Their continued drive for better quality in everything that happens at GITA and selfless
inspiration has always helped us to move ahead.
PROJECT ON
LIBRARY MANAGEMENT
SYSTEM
2021-25
Group members:
• Susil Kumar
Sahu
•Pra
bhupada Nayak
INDEX
Particulars Page
Sl.no.
1 06
Project Analysis
3 Detailed Description 10
4 Source Code 11
5 Outputs And Tables 15
6 Bibliography 18
remarks 19
7
PROJECT ANALYSIS
Our application program is specially
designed for the public library named
"READING COMMUNITY."
We have tried to maximise the efficiency and strived for customer and
user ease as well as satisfaction.
We have thoroughly examined the needs of the library and after the
analysis, we have constructed the program.
modules:
import mysql.connector:
FUNCTIONS:
connect():
This function establishes connection between Python
andMySQL.
cursor():
It is a special control structure that facilitates the row-by- row
processing of records in the result set.
The Syntax is:
<cursor object>=<connection object>.cursor()
execute():
This function is used to execute the sql query and retrieve
records using python.
The syntax is:
<cursor object>.execute(<sql query string>)
def():
A function is a block of code which only runs when it is
called.
fetchall():
This function will return all the rows from the result set in the
form of a tuple containing the records.
fetchone():
This Function will return one row from the result set in the
form of a tuple containing the records.
commit():
This function provides changes in the database physically.
DETAILED
DESCRIPTION
source code
for mysql:
Source code
For python:
import mysql.connector as a
con=a.connect(host="localhost",user="root",passwd="Susil@1@2@3",database="libr
ary1")
def addbook():
bn=input("enter the book name : ")
c=input("enter the book code : ")
t=input("total book : ")
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")
main()
def issueb():
n=input("enter the name : ")
r=input("enter the reg no : ")
co=input("enter book code : ")
r=input("enter the reg no : ")
d=input("enter date : ")
a="insert into issue values(%s,%s,%s,%s)"
data=(n,co,r,d)
c=con.cursor()
c.execute(a,data)
con.commit()
print(">---------------------------------------------------------------<")
print("Book Issued To :",n)
bookup(co,-1)
def submitb():
n=input("enter the name : ")
r=input("enter the reg no : ")
co=input("enter book code : ")
d=input("enter date : ")
data=(n,r,co,d)
a='insert into submit values(%s,%s,%s,%s)'
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()
c.execute(a,data)
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 dbook():
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():
a="select* from books"
c=con.cursor()
c.execute(a)
myresult=c.fetchall()
for i in myresult:
print("book name : ",i[0])
print("book code : ",i[1])
print("total : ",i[2])
print(">---------------------------------------------------------<")
main()
def main():
print("""
LIBRARY MANAGER
1.ADD BOOK
2.ISSUE BOOK
3.SUBMIT BOOK
4.DELETE BOOK
5.DISPLAY BOOKS
""")
print(">----------------------------------------------------------------
<")
if(choice==1):
addbook()
elif(choice==2):
issueb()
elif(choice==3):
submitb()
elif(choice==4):
dbook()
elif(choice==5):
dispbook()
else:
print("wrong choice.........")
main()
def pswd():
ps=input("enter password : ")
if(ps=="Susil@1@2@3"):
main()
else:
print("Wrong password")
pswd()
pswd()
2.)issue a book:
TABLES:
1.)select * from books:
BIBLIOGRAPHY
To develop this project many
references are used
1.https://youtube.com
2.https://google.com
Remark