0% found this document useful (0 votes)
9 views

t

Uploaded by

karansahu1594
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views

t

Uploaded by

karansahu1594
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 40

KENDRIYA VIDYALAYA

DHANPURI

COMPUTER SCIENCE PROJECT 2024-25

PROJECT TOPIC:
LIBRARY MANAGEMENT SYSTEM
CERTIFICATE

This is to certify that KARAN SAHU of class:


XII - A of KENDRIYA VIDYALAYA DHANPURI
has done his project on LIBRARY
MANAGEMENT SYSTEM (DIGITAL LIBRARY)
under my supervision. He has taken interest
and has shown at most sincerity in
completion of this project. I certify this
project up to my expectation & as per
guidelines issued by CBSE, NEW DELHI.

INTERNAL EXAMINAL EXTERNAL


EXAMINAR

PRINCIPAL
ACKNOWLEDGMENT

It is with pleasure that I acknowledge my


sincere gratitude to our teacher, MR.
JAIDEEP PARSAI, PGT (CS) who taught and
undertook the responsibility of teaching the
subject computer science. I have been
greatly benefited from his classes.
I am especially indebted to our Principal MR.
YOGESH KUMAR GUPTA who has always
been a source of encouragement and
support and without whose inspiration this
project would not have been a successful I
would like to place on record heartfelt
thanks to him. Finally, I would like to
express my sincere appreciation for all the
other students for my batch their friendship
& the fine time that we all shared together.
HARDWARES AND SOFTWARES
REQUIRED

HARDWARES
 Desktop Computer/Laptop
 Mobile Phone

SOFTWARES
 Python(latest version)
 MySQL

 MySQL-Connector-Python
TABLE OF CONTENTS
S.No
. Topic Page No.
1 Certificate 1
2 Acknowledgement 2
Hardwares and
Softwares
3 Required 3
4 Introduction 5
5 Python Source Code 10
6 MySQL Database 45
7 Outputs 48
8 References 56

INTRODUCTION

The project LIBRARY MANAGEMENT SYSTEM


(DIGITAL LIBRARY) includes enrolment of
users, adding of books into the library
system. The software has the facility to
search for news, Wikipedia articles. It
includes an authentication facility for admin
and user to login into the admin panel and
user panel resp. of the system. User can see
the books available, details of books issued
by the user in the digital library. The Library
Management System can be login using a
user ID and password. It is accessible either
by an admin or user. Only the admin can
add, delete and update the data of users
and books into the database. The data can
be retrieved easily. The interface is very
user-friendly. The data are well protected for
personal use and makes the data processing
very fast. The purpose of the project entitled
as “DIGITAL LIBRARY” is to computerize the
Front Library Management to develop
software which is user friendly, simple, fast,
and costeffective. It also has a notes facility
where the user can add notes at any point
of the program into the database.
LIBRARY

A library is a collection of books, and


possibly other materials and media, that is
accessible for use by its members and
members of allied institutions. Libraries
provide physical or digital materials, and
may be a physical location, a virtual space,
or both. A library's collection normally
includes printed materials which may be
borrowed, and usually also includes a
reference section of publications which may
only be utilized inside the premises.
Libraries can vary widely in size and may be
organised and maintained by a public body
such as a government, an institution (such
as a school or museum), a corporation, or a
private individual. In addition to providing
materials, libraries also provide the services
of librarians who are trained experts in
finding, selecting, circulating and organising
information while interpreting information
needs and navigating and analysing large
amounts of information with a variety of
resource.
PYTHON
SOURCE
CODE
#IMPORTING MODULE FOR CONNECTIVITY
import mysql.connector
db1 = None
def connect():
global db1
db1 =
mysql.connector.connect(host="localhost",user="root",
password="root",
database = "library"
)

#FUNCTION TO SHOW MEMBERS


def showMembers():
c1 = db1.cursor()
c1.execute("select * from member")
res = c1.fetchall()
print("-"*40)
print("List of Members ")
print("-"*40)

for val in res:


print(val[0] + "\t" + val[1] +"\t"+val[2]+"\t"+val[3])
print("-"*40)

#FUNCTION TO LOGIN
def login():
#print("-" * 40)
print("\t Library Management System")
#print("-" * 40)
print("\t LOGIN")
un = input("Enter User Name : ")
pw = input("Enter Password : ")
q = "select * from users where username = %s and passw =
%s"
val = (un,pw)
c2 = db1.cursor()
c2.execute(q,val)
res = c2.fetchall()
print("-" * 50)
if len(res) == 0:
print("Invalid User Name or Password ")
print("-" * 50)

return False
else:
print("Access Granted !!!")
print("-" * 50)

return True

#FUNCTION TO DELETE MEMBER


def delMember():
print("-" * 40)
print("\tDELETING A MEMBER")
print("-" * 40)
mid = input("Enter Member Id : ")
cursor1 = db1.cursor()
q = "delete from member where mid=" + mid
cursor1.execute(q)
db1.commit()
print("Member Deleted Successfully")
#FUNCTION TO ADD MEMBER
def addMember():
print("-" * 50)
print("\t ADDING A NEW MEMBER")
print("-" * 50)
mid = input("Enter Member Id : ")
name = input("Enter Member Name : ")
phone = input("Enter Phone Number : ")
email = input("Enter Email :")

cursor1 = db1.cursor()
q = "insert into member values (%s,%s,%s,%s)"
val = (mid,name,phone,email)
cursor1.execute(q,val)
db1.commit()
print("Member Added Successfully")
#FUNCTION TO SHOW MEMBERS
def showMembers():
cursor1 = db1.cursor()
cursor1.execute("Select * from Member")
res = cursor1.fetchall()
print("-" * 50)
print(" MEMBER DETAILS ")
print("-" * 50)
print("Id Name Email Phone ")
for k in res:
print(k[0]," ",k[1]," ",k[2]," ",k[3])

#FUNCTION DELETE BOOK


def delBook():
print("-" * 40)
print("\tDELETING A BOOK")
print("-" * 40)
bid = input("Enter Book Id : ")
cursor1 = db1.cursor()
q = "delete from book where bookid=" + bid
cursor1.execute(q)
db1.commit()
print("Book Deleted Successfully")

#FUNCTION T O ADD BOOK


def addBook():
print("-" * 50)
print("\t ADDING A NEW BOOK")
print("-" * 50)
bid = input("Enter Book Id : ")
title = input("Enter Book Title : ")
author = input("Enter Author name : ")
pub = input("Enter Publisher :")
cost = int(input("Enter Cost of the book :"))
cursor1 = db1.cursor()
q = "insert into book values (%s,%s,%s,%s,%s)"
val = (bid,title,author,pub,cost)
cursor1.execute(q,val)
db1.commit()
print("Book Added Successfully")

#FUNCTION TO SHOW BOOKS


def showBooks():
cursor1 = db1.cursor()
cursor1.execute("Select * from Book")
res = cursor1.fetchall()
print("-" * 50)
print(" BOOK DETAILS ")
print("-" * 50)

print("Id Title Author Publisher Cost ")


for k in res:
print(k[0]," ",k[1]," ",k[2]," ",k[3],"\t",k[4])
#FUNCTION TO SHOW ISSUED DETAILS
def showIssued():
cursor1 = db1.cursor()
cursor1.execute("Select * from issue")
res = cursor1.fetchall()
print(" LIST OF ISSUED BOOKS ")
print("-" * 40)
print("Member Bookid Issue Date")
for k in res:
print(k[0],"\t",k[1],"\t",k[2])
print("-" * 40)

#FUNCTION TO SHOW RETURNED DETAILS


def showReturned():
cursor1 = db1.cursor()
cursor1.execute("Select * from issuelog")
res = cursor1.fetchall()
print(" LIST OF RETURNED BOOKS ")
print("-" * 50)
print("Member Bbokid Issue Date Return Date")
for k in res:
print(k[0],"\t",k[1],"\t",k[2],"\t",k[3])
print("-" * 50)

def issueBook():
bid = input("Enter the book id to be issued : ")
q ="select * from issue where bookid='" + bid +"'"
cursor1 = db1.cursor()
cursor1.execute(q)
res = cursor1.fetchall()
if len(res)== 0:
mid = input("Enter the member id : ")
doi = input("Enter the date of issue : ")
q = "insert into issue (mid,bookid,dateofissue)
values(%s,%s,%s)"
data = (mid,bid,doi)
cursor1.execute(q,data)
db1.commit()
print("-" * 40)
print(" Book Issued Successfully")
print("-" * 40)

else:
print("-" * 40)
print(" Sorry ! The Book is not available")
print("-" * 40)

#FUNCTION TO RETURN BOOK


def returnBook():
bid = input("Enter the book id to be returned : ")
mid = input("Enter the Member id : ")
q ="select dateofissue from issue where bookid='" + bid
+"' and mid='" + mid +"'"
cursor1 = db1.cursor()
cursor1.execute(q)
res = cursor1.fetchall()
if len(res)== 0:
print("-" * 40)
print("This Book is not Issued to This Member ")
print("-" * 40)
else:
dort = input("Enter the date of return : ")
q = "delete from issue where bookid='" + bid + "' and
mid='" + mid + "'"
cursor1.execute(q)
db1.commit()
q = "insert into issuelog values(%s,%s,%s,%s)"
data = (mid,bid,res[0][0],dort)
cursor1.execute(q,data)
db1.commit()
print("Book Returned !!!")

connect()
print("Connected")
print(" WELCOME TO LIBRARY")
if login():
while True:
print("-" * 50)
print("\t CHOOSE AN OPERATION ")
print("-" * 50)
print("Press 1 - Add a New Member")
print("Press 2 - Delete an Existing Member")

print("Press 3 - Show all Members")


print("Press 4 - Add a New Book")
print("Press 5 - Delete an Existing Book")
print("Press 6 - Show all Books")
print("Press 7 - Issue a Book")
print("Press 8 - Return a Book")
print("Press 9 - Show Issued Books")
print("Press 10 - Show Returned Books")
print("Press 11 - Quit")
ch = int(input("Enter Your Choice : "))
if ch == 1:
addMember()
elif ch == 2:
delMember()
elif ch == 3:
showMembers()
elif ch == 4:
addBook()
elif ch == 5:
delBook()
elif ch == 6:
showBooks()
elif ch == 7:
issueBook()
elif ch == 8:
returnBook()
elif ch == 9:
showIssued()
elif ch == 10:
showReturned()
elif ch == 11:
break
MySQL
DATABASE
LIBRARY DATABASE:
BOOK TABLE:
OUTPUTS
USER AUTHENTICATION:

You might also like