Library Management
Library Management
NAME : GLORY
ROLL NO : 24
2|Page
CERTIFICATE
___________________
Teacher’s Signature
3|Page
TABLE OF CONTENTS
S CONTENT PG
NO NO.
01 CERTIFICATE 02
02 ACKNOWLEDGEMENT 04
03 INTRODUCTION 06
04 KEY FEATURES 06
06 MYSQL TABLES 08
07 SOURCE CODE 10
08 OUTPUT 18
4|Page
ACKNOWLEDGEMENT
5|Page
INTRODUCTION
This project is a comprehensive software solution for managing
student records. It empowers administrators to handle student data
efficiently by providing features to add new records, update existing
ones, view complete details, and delete entries if needed. Built using
Python and MySQL, the software ensures seamless database
integration and secure data handling. Additionally, it offers user-
friendly interaction and error handling, making it an ideal system for
educational institutions or personal use. This program simplifies
record management with accuracy and efficiency.
6|Page
KEY FEATURES:
1. Database Management: The system uses MySQL to store and organize
data about books and members.
2. User-Friendly Interface: The program uses Python to create an easy-to-
use menu for adding, viewing, and managing books and members.
3. Data Handling: It performs basic tasks like adding new books, adding
new members, and displaying existing data from the database.
4. Expandable: The system can be easily updated to add more features like
book checkout or overdue fines.
5. Practical Learning: The project helps students understand how to use
programming to solve real-world problems and manage data effectively.
~ SQL TABLES ~
7|Page
Account Table -
Book Table -
Lending Table -
Order Table -
8|Page
9|Page
# SOURCE CODE FOR LIBRARY
print("""****************************
* *
**** LIBRARY CODES ****
* *
****************************""")
#CREATING DATABASE
import mysql.connector
mydb=mysql.connector.connect(host="localhost",user="root",password="123
4")
mycursor=mydb.cursor()
mycursor.execute("create database if not exists library")
mycursor.execute("use library")
while True:
10 | P a g e
print("12. Order a new book")
print("15. Exit")
if ch==2:
cardno=str(input("Enter card no:"))
mycursor.execute("select * from library_master where
cardno='"+cardno+"'")
for i in mycursor:
print(i)
if ch==3:
print("press 1 to update name:")
print(" ")
print("press 2 to update phone no:")
print(" ")
print("press 3 to update address:")
print(" ")
print("press 4 to update date of birth:")
print(" ")
ch1=int(input("Enter your choice:"))
11 | P a g e
if ch1==1:
mycursor.execute("select * from library_master")
for i in mycursor:
print(i)
cardno=str(input("Enter card no:"))
name_of_person=str(input("Enter new name:"))
mycursor.execute("update library_master set
name_of_person='"+name_of_person+"' where cardno='"+cardno+"'")
mydb.commit()
print("*Name has been updated*")
mycursor.execute("select * from library_master")
for i in mycursor:
print(i)
if ch1==2:
mycursor.execute("select * from library_master")
for i in mycursor:
print(i)
cardno=str(input("Enter card no:"))
phone_no=str(input("Enter new phone no:"))
mycursor.execute("update library_master set
phone_no='"+phone_no+"' where cardno='"+cardno+"'")
mydb.commit()
print("*Number has been updated*")
mycursor.execute("select * from library_master")
for i in mycursor:
print(i)
if ch1==3:
mycursor.execute("select * from library_master")
for i in mycursor:
print(i)
cardno=str(input("Enter card no:"))
address=str(input("Enter new address:"))
mycursor.execute("update library_master set
address='"+address+"' where cardno='"+cardno+"'")
mydb.commit()
print("*Address has been updated*")
mycursor.execute("select * from library_master")
for i in mycursor:
print(i)
if ch1==4:
mycursor.execute("select * from library_master")
for i in mycursor:
print(i)
cardno=str(input("Enter card no:"))
dob=str(input("Enter new date of birth(yyyy-mm-dd):"))
mycursor.execute("update library_master set dob='"+dob+"'
where cardno='"+cardno+"'")
mydb.commit()
print("*Date of birth has been updated*")
mycursor.execute("select * from library_master")
12 | P a g e
for i in mycursor:
print(i)
if ch==4:
mycursor.execute("select * from library_master")
for i in mycursor:
print(i)
cardno=str(input("Enter card no:"))
mycursor.execute("delete from library_master where
cardno='"+cardno+"'")
mydb.commit()
print("*Removed succesfully*")
mycursor.execute("select * from library_master")
for i in mycursor:
print(i)
if ch==5:
print("FILL ALL BOOK DETAILS ")
book_name=str(input("enter book name:"))
book_no=str(input("Enter no (limit 5 characters):"))
genre=str(input("Enter genre:"))
authors_name=str(input("Enter the authors name (max 15
words):"))
language=str(input("Enter the language of book:"))
mycursor.execute("insert into books
values('"+book_name+"','"+book_no+"','"+genre+"','"+authors_name+"','"+
language+"')")
mydb.commit()
print("Book added succesfully*")
for i in mycursor:
print(i)
if ch==6:
book_no=str(input("Enter Book No:"))
mycursor.execute("select * from books where
book_no='"+book_no+"'")
for i in mycursor:
print(i)
if ch==7:
print("press 1 to update Book name")
print(" ")
print("press 2 to update genre")
print(" ")
print("press 3 to update Author Name")
print(" ")
print("press 4 to update Language")
print(" ")
ch1=int(input("Enter your choice:"))
if ch1==1:
mycursor.execute("select * from books")
13 | P a g e
for i in mycursor:
print(i)
book_no=str(input("Enter bookno:"))
name_of_book=str(input("Enter new name:"))
mycursor.execute("update books set
book_name='"+name_of_book+"' where book_no='"+book_no+"'")
mydb.commit()
print("*Name has been updated*")
mycursor.execute("select * from books")
for i in mycursor:
print(i)
if ch1==2:
mycursor.execute("select * from books")
for i in mycursor:
print(i)
book_no=str(input("Enter card no:"))
genre=str(input("Enter new genre:"))
mycursor.execute("update books set genre='"+genre+"' where
book_no='"+book_no+"'")
mydb.commit()
print("*Genre has been updated*")
mycursor.execute("select * from books")
for i in mycursor:
print(i)
if ch1==3:
mycursor.execute("select * from books")
for i in mycursor:
print(i)
book_no=str(input("Enter book no:"))
author=str(input("Enter new authors name:"))
mycursor.execute("update books set
authors_name='"+author+"' where book_no='"+book_no+"'")
mydb.commit()
print("*Authors name has been updated*")
mycursor.execute("select * from books")
for i in mycursor:
print(i)
if ch1==4:
mycursor.execute("select * from books")
for i in mycursor:
print(i)
book_no=str(input("Enter boom no:"))
language=str(input("Enter new language:"))
mycursor.execute("update books set language='"+language+"'
where book_no='"+book_no+"'")
mydb.commit()
print("*Language has been updated*")
mycursor.execute("select * from books")
for i in mycursor:
14 | P a g e
print(i)
if ch==8:
mycursor.execute("select * from books")
for i in mycursor:
print(i)
book_no=str(input("Enter book no:"))
mycursor.execute("delete from books where
book_no='"+book_no+"'")
mydb.commit()
print("*Removed succesfully*")
mycursor.execute("select * from books")
for i in mycursor:
print(i)
if ch==9:
print("if you wanna go back press 1")
print(" ")
print("if you wanna coontinue press 2")
print(" ")
a=int(input("enter your choice:"))
if a==1:
continue
if a==2:
cardno=str(input("Enter card no:"))
book_name=str(input("Enter the name of the book:"))
date_of_lend=str(input("Enter date of lending(yyyy-mm-
dd)"))
print("if book not returned then enter(0000-00-00):")
date_of_return=str(input("enter date of return(yyyy-mm-
dd):"))
mycursor.execute("insert into library_transaction
values('"+cardno+"','"+book_name+"','"+date_of_lend+"','"+date_of_retur
n+"')")
mydb.commit()
if ch==10:
print("if you wanna go back press 1")
print(" ")
print("if you wanna coontinue press 2")
print(" ")
a=int(input("enter your choice:"))
if (a==1):
continue
if a==2:
cardno=str(input("Enter card no:"))
date_of_return=str(input("Enter date of returning(yyyy-mm-
dd):"))
mycursor.execute("update library_transaction set
date_of_return='"+date_of_return+"' where cardno='"+cardno+"'")
mydb.commit()
15 | P a g e
if ch==11:
cardno=str(input("Enter card no:"))
mycursor.execute("select * from library_transaction where
cardno='"+cardno+"'")
for i in mycursor:
print(i)
if ch==12:
orderno=str(input("Enter the order no:"))
name_of_book=str(input("Enter the name of the book:"))
del_date=str(input("enter the expected delivery date of
books(yyyy-mm-dd):"))
price=str(input("Enter the price of the book"))
mycursor.execute("insert into buy_new_books
values('"+orderno+"','"+name_of_book+"','"+del_date+"','"+price+"')")
mydb.commit()
if ch==13:
print("press 1 to update name of book")
print(" ")
print("press 2 to update delivery date")
print(" ")
print("press 3 to update price")
print(" ")
ch1=int(input("Enter your choice:"))
if ch1==1:
mycursor.execute("select * from buy_new_books")
for i in mycursor:
print(i)
orderno=str(input("Enter order no:"))
name_of_book=str(input("Enter new name:"))
mycursor.execute("update buy_new_books set
name_of_book='"+name_of_book+"' where orderno='"+orderno+"'")
mydb.commit()
print("*Name has been updated*")
mycursor.execute("select * from buy_new_books")
for i in mycursor:
print(i)
if ch1==2:
mycursor.execute("select * from buy_new_books")
for i in mycursor:
print(i)
orderno=str(input("Enter card no:"))
del_date=str(input("Enter new delivery date(yyyy-mm-dd):"))
mycursor.execute("update buy_new_books set
del_date='"+del_date+"' where orderno='"+orderno+"'")
mydb.commit()
print("*Delivery date has been updated*")
16 | P a g e
mycursor.execute("select * from buy_new_books")
for i in mycursor:
print(i)
if ch1==3:
mycursor.execute("select * from buy_new_books")
for i in mycursor:
print(i)
orderno=str(input("Enter card no:"))
price=str(input("Enter new price:"))
mycursor.execute("update buy_new_books set
price='"+price+"' where orderno='"+orderno+"'")
mydb.commit()
print("*Price has been updated*")
mycursor.execute("select * from buy_new_books")
for i in mycursor:
print(i)
elif(ch==14):
orderno=str(input("Enter order number:"))
mycursor.execute("select * from buy_new_books where
orderno='"+orderno+"'")
for i in mycursor:
print(i)
else:
break
__________________________________________________________________
17 | P a g e
18 | P a g e
-: OUTPUT :-
19 | P a g e
20 | P a g e
21 | P a g e
HARDWARE AND SOFTWARE
REQUIREMENTS
RAM – 8.00 GB
HDD – 500 GB
2. Python IDLE
3. MySQL server
4. MySQL connector
22 | P a g e
BIBLIOGRAPH
Y
1. Computer science With Python - Class XII By :
Sumita Arora
2. Wikipedia.com
3. Slideshare.com
4. Youtube.com
5. Programiz.com
23 | P a g e
24 | P a g e