LibrarymanagementCSproject
LibrarymanagementCSproject
Class: XII
Subject: Computer Science [083]
Academic Year: 2022 – 23
PROJECT
ON
LIBRARY MANAGEMENT SYSTEM
SUBMITTEDBY: SUBMITTEDTO:
___________________ __________________
pg. 1
Declaration
I hereby declare that the project work entitled Library management,
submitted to Department of Computer Science, Saraswati International
School is prepared by me. All the coding is result of my personal efforts.
Chetna I Singh
XII D
pg. 2
Acknowledgement
It is with great pleasure that I find myself planning down this line to
express my sincere thanks to various people who helped me a long
way in completing this project.
pg. 3
Index
Sr.No. Content Pg.
No.
1 Declaration 2
2 Acknowledgement 3
3 Libraries Used 5
4 Software and Hardware Requirements 6
5 Working Description 7
6 Coding 8
7 Output 29
8 Bibliography 54
pg. 4
Libraries And Modules
Used
Python Libraries used:
Import Python Module
Def Python Function
pg. 5
Hardware and Software
Requirements
1) Python language
2) My SOL language
3) MYSQL Connecter
pg. 6
Working Description
def insert_book():
print("************WELCOME TO LIBRARY MANAGEMENT
SYSTEM **************")
print("*******PLEASE FILL THE DETAILS YOU WANT TO
INSERT**************")
ID=int(input('Enter book ID :'))
Name=input('Enter book name :')
Author=input('Enter book author name :')
Type=input('Enter book type :')
Price=int(input('Enter book price :'))
Rentprice=int(input('Enter book rented price :'))
Wing=input("Enter wing:")
Shelve=int(input("Enter shelve no:"))
data="insert into
books(Book_ID,Book_name,Book_Author,Book_Type,Book_Price,Book_Ren
tprice,Wing,Shelves) values({},'{}','{}','{}',{},
{},'{}','{}')".format(ID,Name,Author,Type,Price,Rentprice,Wing,Shelve)
cur_obj.execute(data)
con_obj.commit()
print('*'*500)
print('Book Inserted successfully!')
pg. 9
option()
def update_book():
print("*********WELCOME TO LIBRARY MANAGEMENT
SYSTEM******")
print("*********PLEASE FILL THE DETAILS YOU WANT TO
UPDATE**********")
ID=int(input("Enter Book ID:"))
Name=input("Enter Book Name:")
Author=input("Enter Book Author name:")
Type=input("Enter Book Type:")
Price=int(input("Enter Book Price:"))
Rentprice=int(input("Enter Book Rent Price:"))
cur_obj=con_obj.cursor()
data="update books set
Book_Name='{}',Book_Author='{}',Book_Type='{}',Book_Price={},Book_R
entprice={} where
Book_ID={}".format(Name,Author,Type,Price,Rentprice,ID)
cur_obj.execute(data)
con_obj.commit()
print('*'*500)
print(" Book is updated Successfully!")
option()
def delete_book():
print("******************WELCOME TO LIBRARY MANAGEMENT
SYSTEM*****************")
print("**************PLEASE ENTER THE RECORD YOU WANT TO
DELETE*****************")
ID=int(input("Enter Book ID:"))
data="delete from books where Book_ID={}".format(ID)
cur_obj.execute(data)
con_obj.commit()
print('*'*500)
print("Book details has been Deleted")
pg. 10
option()
def search_book():
print("************WELCOME TO LIBRARY MANAGEMENT
SYSTEM****************")
print("**********PLEASE ENTER THE DETAILS YOU WANT TO
SEARCH**********")
ID=int(input("Enter Book ID:"))
cur_obj=con_obj.cursor()
data="select * from books where Book_ID={}".format(ID)
cur_obj.execute(data)
row=cur_obj.fetchall()
print(row)
con_obj.close()
print('*'*500)
print("All the Book Details has been Searched!")
option()
def display_book():
print("***************WELCOME TO LIBRARY MANAGEMENT
SYSTEM***************")
print("*****************ALL THE DETAILS OF YOUR TABLE
STATED DISPLAYING************")
cur_obj=con_obj.cursor()
data="select * from books"
cur_obj.execute(data)
row=cur_obj.fetchall()
print(row)
con_obj.close()
print('*'*500)
print("All the details has been Displayed!")
option()
pg. 11
def insert_branch():
print("***********WELCOME TO LIBRARY MANAGEMENT
SYSTEM*************")
print("***********PLEASE FILL THE INFORMATION YOU HAVE TO
INSERTED**********")
ID=int(input("Enter Branch id:"))
Name=input("Enter Branch name:")
Location=input("Enter Branch Location:")
cur_obj=con_obj.cursor()
data="insert into branch(Branch_ID,Branch_Name,Branch_location)
values({},'{}','{}')".format(ID,Name,Location)
cur_obj.execute(data)
con_obj.commit()
print('*'*500)
print('Branch Insertion is successfull!')
option()
def update_branch():
print("***************WELCOME TO LIBRARY MANAGEMENT
SYSTEM******************")
print("***************PLEASE FILL THE DETAILS YOU WANT
UPDATE******************")
ID=int(input("Enter Branch ID:"))
Name=input("Enter Branch Name:")
Location=input("Enter Branch Location:")
cur_obj=con_obj.cursor()
data="update branch set Branch_Name='{}',Branch_Location='{}' where
Branch_ID={}".format(Name,Location,ID)
cur_obj.execute(data)
con_obj.commit()
print('*'*500)
print("Updation of all the details has been Sucessfull Done!")
option()
def delete_branch():
pg. 12
print("**************WELCOME TO LIBRARY MANAGEMENT
SYSTEM***********")
print("**************PLEASE ENTER THE DETAILS YOU WANT TO
DELETE**************")
con_obj.commit()
print('*'*500)
print("Details has been Delete Sucessfully!")
option()
def search_branch():
print("**************WELCOME TO LIBRARY MANAGEMENT
SYSEM******************")
print("***************PLEASE ENTER THE DETAILS YOUR WANT
TO SEARCH***********")
ID=int(input("Enter Branch ID:"))
cus_obj=con_obj.cursor()
data="select * from branch where Branch_ID={}".format(ID)
cur_obj.execute(data)
row=cur_obj.fetchall()
print(row)
con_obj.close()
print('*'*500)
print("Branch search is sucessfull!")
option()
def display_branch():
print("***************WELCOME TO LIBRARY MANAGEMENT
SYSTEM************")
pg. 13
print("**************ALL THE DEATILS HAS BEEN STARTED
DISPLAYING*********")
cur_obj=con_obj.cursor()
data="select * from branch"
cur_obj.execute(data)
row=cur_obj.fetchall()
print(row)
con_obj.close()
print('*'*500)
print("Branch Details has been Sucessfully Displayed")
option()
def insert_customer():
print("***********WELCOME TO LIBRARY MANAGEMENT
SYSTEM****************")
print("**********PLEASE FILL THE DETAILS YOU WANT TO
INSERT*************")
ID=int(input("Enter Customer ID:"))
Name=input("Enter Customer Name:")
Email=input("Enter Customer Email address:")
Address=input("Enter Customer Address:")
Phno=int(input("Enter Customer Phone No:"))
BranchID=int(input("Enter Branch Id:"))
cur_obj=con_obj.cursor()
data="insert into
customer(Customer_ID,Coustomer_Name,Coustomer_Email,Coustermer_Add
ress,Coustermer_Phon_no,Branch_ID) values({},'{}','{}','{}',{},
{})".format(ID,Name,Email,Address,Phno,BranchID)
cur_obj.execute(data)
con_obj.commit()
print('*'*500)
print("Customer Details has been Inserted")
option()
pg. 14
def update_customer():
print("***************WELCOME TO LIBRARY MANGEMENT
SYSTEM****************")
print("***************PLEASE ENTER THE DETAILS YOU WANT
TO UPDATE***********")
ID=int(input("Enter Customer ID:"))
Name=input("Enter Customer Name:")
Email=input("Enter Customer Email address:")
Address=input("Enter Customer Address:")
Phno=int(input("Enter Customer Phone No:"))
BranchID=int(input("Enter Branch ID:"))
data="update customer set
Coustomer_Name='{}',Coustomer_Email='{}',Coustermer_Address='{}',Coust
ermer_Phon_no={},Branch_ID={} where
Customer_ID={}".format(Name,Email,Address,Phno,BranchID,ID)
cur_obj.execute(data)
con_obj.commit()
print('*'*500)
print("All the Details has been Updated")
option()
def delete_customer():
print("********************WELCOME TO LIBRARY
MANAGEMENT SYSTEM**************")
print("********************PLEASE ENTER DETAILS YOU
WANT TO DELETE**************")
ID=int(input("Enter Customer ID:"))
cur_obj=con_obj.cursor()
data="delete from customer where Customer_ID={}".format(ID)
cur_obj.execute(data)
con_obj.commit()
print('*'*500)
print("All the details has been Deleted!")
pg. 15
option()
def search_customer():
print("**************WELCOME TO LIBRARY MANAGEMENT
SYSTEM***************")
print("**************PLEASE ENTER THE DETAILS YOU WANT TO
SEARCH****************")
ID=int(input("Enter customer ID:"))
cur_obj=con_obj.cursor()
data="select * from customer where Customer_ID={}".format(ID)
cur_obj.execute(data)
row=cur_obj.fetchall()
print(row)
con_obj.close()
print('*'*500)
print("All the details has been Searched Sucessfully!")
option()
def display_customer():
print("***********WELCOME TO LIBRARY MANAGEMENT
SYSTEM*******************")
print("***********DISPLAY OF ALL THE DETAILS HAS BEEN
STATED*************")
cus_obj=con_obj.cursor()
print('*'*500)
print("All the details has been Displayed!")
option()
pg. 16
def insert_issuebook():
print("*************WELCOME TO LIBRARY MANAGEMEN
SYSTEM*************")
print("*************PLEASE FILL THE DETAILS YOU WANT TO
INSERT***********")
ID=int(input('Enter Book ID :'))
Name=input('Enter Book Name :')
Issuedate=input('Enter Issue date :')
Expirydate=input('Enter Expiry date:')
CustomerID=int(input('Enter Customer ID:'))
cur_obj=con_obj.cursor()
data="insert into
issue(Book_ID,Book_Name,Issue_Date,Expiry_Date,Customer_ID)
values({},'{}','{}','{}',{})".format(ID,Name,Issuedate,Expirydate,CustomerID)
cur_obj.execute(data)
con_obj.commit()
print('*'*500)
print("Details of BooK Issued has been Inserted")
option()
def update_issuebook():
print("**************** WELCOME TO LIBRARY MANAGEMENT
SYSTEM*******************")
print("****************PLEASE FILL THE DETAILS YOU WANT TO
UPDATE******************")
def delete_issuebook():
print("******************WELCOME TO LIBRARY
MANAGEMENT SYSTEM*********************")
print("******************PLEASE FILL THE DETAILS YOU
WANT TO DELETE*******************")
ID=int(input("ENTER BOOK ID"))
cur_obj=con_obj.cursor()
data="delete from issue where Book_ID={}".format(ID)
cur_obj.execute(data)
con_obj.commit()
print('*'*500)
print("DETAILS OF BOOK HAS BEEN SUCESSFULLY
DELETED")
option()
def search_issuebook():
print("*********************WELCOME TO LIBRARY
MANAGEMENT SYSTEM****************************")
print("*********************PLEASE FILL THE DETAILS YOU
WANT TO SEARCH**************************")
ID=int(input("ENTER BOOK ID"))
data="select * from issue where Book_ID={}".format(ID)
cur_obj.execute(data)
row=cur_obj.fetchall()
print(row)
con_obj.close()
pg. 18
print('*'*500)
print("DETAILS OF BOOK HAS BEEN SUCESSFULLY SEARCHED")
option()
def display_issuebook():
print("**************WELCOME TO LIBRARY MANGEMENT
SYSTEM*************")
print("**************DETAILS OF ALL THE BOOKS HAS BEEN
DISPLAYED*************")
cur_obj=con_obj.cursor()
data="select * from issue"
cur_obj.execute(data)
row=cur_obj.fetchall()
print(row)
con_obj.close()
print('*'*500)
print("DETAILS OF ALL THE BOOKS HAS BEEN DISPLAYED")
option()
def insert_returnbook():
print("*************WELCOME TO LIBRARY MANAGEMENT
SYSTEM**********")
print("*********PLEASE FILL THE DETAILS YOU WANT TO
INSERT**************")
ID=int(input("Enter book ID:"))
Name=input("Enter Book Name:")
Issuedate=input("Enter Issued Date:")
Expirydate=input("Enter Expiry Date:")
CustomerID=int(input("Enter Customer ID:"))
StaffID=int(input("Enter Staff ID:"))
cur_obj=con_obj.cursor()
data="insert into
returnbooks(Book_ID,Book_Name,Issue_Date,Expiry_Date,Coustomer_ID,St
aff_ID) values({},'{}','{}','{}',{},
{})".format(ID,Name,Issuedate,Expirydate,CustomerID,StaffID)
cur_obj.execute(data)
pg. 19
con_obj.commit()
print('*'*500)
print("Details of return book has been Inserted")
option()
def update_returnbook():
print("***************************WELCOME TO LIBRARY
MANAGEMENT SYSTEM**************")
print("***************************PLEASE FILL THE DETAILS
YOU WANT TO UPDATE*************")
ID=int(input("ENTER BOOK ID:"))
Name=input("ENTER BOOK NAME:")
Issuedate=input("ENTER ISSUED DATE:")
Expirydate=input("ENTER EXPIRY DATE:")
CustomerID=int(input("ENTER CUSTOMER ID:"))
StaffID=int(input("ENTER STAFF ID:"))
cun_obj=con_obj.cursor()
data="update returnbooks set
Book_Name='{}',Issue_Date='{}',Expiry_Date='{}',Coustomer_ID={},Staff_I
D={} where
Book_ID={}".format(Name,Issuedate,Expirydate,CustomerID,StaffID,ID)
cur_obj.execute(data)
con_obj.commit()
print('*'*500)
print("DETAILS OF THE BOOK HAS BEEN UPDATED")
option()
def delete_returnbook():
print("******************************WELCOME TO LIBRARY
MANAGEMENT SYSTEM**********************")
print("******************************PLEASE FILL THE DETAILS
YOU WANT TO DELETE*********************")
ID=int(input("ENTER BOOK ID"))
pg. 20
cur_obj=con_obj.cursor()
data="delete from returnbooks where Book_ID={}".format(ID)
cur_obj.execute(data)
con_obj.commit()
print('*'*500)
print("DETAILS OF THE BOOK HAS BEEN DELETED")
option()
def search_returnbook():
print("*****************************WELCOME TO LIBRARY
MANAGEMENT SYSTEM************************")
print("*****************************PLEASE FILL THE DETAILS
YOU WANT TO SEARCH***********************")
ID=int(input("ENTER BOOK ID "))
cur_obj=con_obj.cursor()
data="select * from returnbooks where Book_ID={}".format(ID)
cur_obj.execute(data)
row=cur_obj.fetchall()
print(row)
con_obj.close()
print('*'*500)
print("DETAILS OF THE BOOK HAS BEEN SUCESSFULLY
SEARCHED ")
option()
def display_returnbook():
print("********************************WELCOME TO LIBRARY
MANAGEMENT SYSTEM***************************")
print("********************************PLEASE FILL THE
DETAILS YOU WANT TO DISPLAY*************************")
cur_obj=con_obj.cursor()
data="select * from returnbooks"
cur_obj.execute(data)
pg. 21
row=cur_obj.fetchall()
print(row)
con_obj.close()
print('*'*500)
print("DETAILS OF THE BOOK HAS BEEN DISPLAYED
SUCESSFULLY")
option()
def insert_staff():
print("**********WELCOME TO LIBRARY MANAGEMENT
SYSTEM*************")
print("***********PLEASE FILL THE DEATILS YOU WANT TO
INSERT************")
ID=int(input("Enter Staff ID:"))
Name=input("Enter Staff Name:")
Address=input("Enter Staff Address:")
Gender=input("Enter Staff Gender:")
Phon_no=int(input("Enter Staff Phone No:"))
Branch_ID=int(input("Enter Branch ID:"))
cur_obj=con_obj.cursor()
data="insert into
staff(Staff_ID,Staff_Name,Staff_address,Staff_Gender,Staff_Phon_no,Branch
_ID) values({},'{}','{}','{}',{},
{})".format(ID,Name,Address,Gender,Phon_no,Branch_ID)
cur_obj.execute(data)
con_obj.commit()
print('*'*500)
print("Staff Details has been Insert")
option()
def update_staff():
print("****************************WELCOME TO LIBRARY
MANAGEMENT SYSTEM*****************************")
print("****************************FILL THE DETAILS YOU
WANT TO UPDATE ***********************************")
pg. 22
ID=int(input("ENTER STAFF ID:"))
Name=input("ENTER STAFF NAME:")
Address=input("ENTER STAFF ADDRESS:")
Gender=input("ENTER STAFF GENDER:")
Phone_no=int(input ("ENTER STAFF PHONE NO:"))
Branch_ID=int(input("ENTER BRANCH ID:"))
data="update staff set
Staff_Name='{}',Staff_Address='{}',Staff_Gender='{}',Staff_Phon_no={},Bra
nch_ID={} where
Staff_ID={}".format(Name,Address,Gender,Phone_no,Branch_ID,ID)
cur_obj.execute(data)
con_obj.commit()
print('*'*500)
print("STAFF DETAILS HAS BEEN UPDATED")
option()
def delete_staff():
print("**********WELCOME TO LIBRARY MANAGEMENT
SYSTEM*************")
print("**********ENTER THE DETAILS YOU WANT TO
DELETE***************")
ID=int(input("Enter Staff Id:"))
data="delete from staff where Staff_ID={}".format(ID)
cur_obj.execute(data)
con_obj.commit()
print('*'*500)
print("STAFF DETAILS HAS BEEN DELETED")
option()
def search_staff():
print("******************WELCOME TO LIBRARY MANAGEMENT
SYSTEM****************")
print("**************ENTER THE DETAILS YOU WANT TO
pg. 23
SEARCH****************")
ID=int(input("Enter Staff ID:"))
cur_obj=con_obj.cursor()
data="select * from staff where Staff_ID={}".format(ID)
cur_obj.execute(data)
row=cur_obj.fetchall()
print(row)
con_obj.close()
print('*'*500)
print("STAFF DETAILS HAS BEEN SEARCHED SUCESSFULLY")
option()
def display_staff():
print("*********************WELCOME TO LIBRARY
MANAGEMENT SYSTEM*******************")
print("**********************DISPLAY DETAILS OF ALL THE
BOOKS***************************")
cur_obj=con_obj.cursor()
data="select * from staff"
cur_obj.execute(data)
row=cur_obj.fetchall()
print(row)
con_obj.close()
print('*'*500)
print("DETAILS OF ALL THE BOOKS HAS BEEN DISPLAYED
SUCESSFULLY")
option()
def option():
print(""" LIBRARY MANAGEMENT
OPTIONS
pg. 24
1 INSERT BOOKS
2 UPDATE BOOKS
3 DELETE BOOKS
4 SEARCH BOOKS
5 DISPLAY BOOKS
6 INSERT BRANCH
7 UPDATE BRANCH
8 DELETE BRANCH
9 SEARCH BRANCH
10 DISPLAY BRANCH
11 INSERT CUSTOMER
12 UPDATE CUSTOMER
13 DELETE CUSTOMER
14 SEARCH CUSTOMER
15 DISPLAY CUSTOMER
16 INSERT ISSUE BOOK
17 UPDATE ISSUE BOOK
18 DELETE ISSUE BOOK
19 SEARCH ISSUE BOOK
20 DISPLAY ISSUE BOOK
21 INSERT RETURN BOOK
22 UPDATE RETURN BOOK
23 DELETE RETURN BOOK
24 SEARCH RETURN BOOK
25 DISPLAY RETURN BOOK
26 INSERT STAFF
27 UPDATE STAFF
28 DELETE STAFF
29 SEARCH STAFF
30 DISPLAY STAFF
31 LOG OUT
""")
ch=int(input('Enter your option :'))
print('<<<<--------------------------------------------------------------------->>>>')
if ch==1:
insert_book()
elif ch==2:
pg. 25
update_book()
elif ch==3:
delete_book()
elif ch==4:
search_book()
elif ch==5:
display_book()
elif ch==6:
insert_branch()
elif ch==7:
update_branch()
elif ch==8:
delete_branch()
elif ch==9:
search_branch()
elif ch==10:
display_branch()
elif ch==11:
insert_customer()
elif ch==12:
update_customer()
elif ch==13:
delete_customer()
elif ch==14:
search_customer()
elif ch==15:
display_customer()
elif ch==16:
insert_issuebook()
elif ch ==17:
update_issuebook()
elif ch==18:
delete_issuebook()
elif ch==19:
search_issuebook()
elif ch==20:
pg. 26
display_issuebook()
elif ch==21:
insert_returnbook()
elif ch==22:
update_returnbook()
elif ch==23:
delete_returnbook()
elif ch==24:
search_returnbook()
elif ch==25:
display_returnbook()
elif ch==26:
insert_staff()
elif ch==27:
update_staff()
elif ch==28:
delete_staff()
elif ch==29:
search_staff()
elif ch==30:
display_staff()
elif ch==31:
print("LOG OUT")
else:
print("INVALID CHOICE")
option()
def log_in():
print("*************WELCOME TO LIBRARY MANAGEMENT
SYSTEM************** ")
user=input(' Enter username :')
passwd=input(' Enter passwd :')
if user!='acv1942':
print('check you user name')
log_in()
pg. 27
elif passwd!='py1942':
print('Wrong passwd')
lon_in()
else:
option()
log_in()
pg. 28
OUTPUT
Output:
pg. 29
pg. 30
pg. 31
pg. 32
pg. 33
pg. 34
pg. 35
pg. 36
pg. 37
pg. 38
pg. 39
pg. 40
pg. 41
pg. 42
pg. 43
pg. 44
pg. 45
pg. 46
pg. 47
pg. 48
pg. 49
pg. 50
pg. 51
pg. 52
pg. 53
pg. 54
Bibliography
All the information used in this project is taken from following websites:
pg. 55