INFORMATICS
PRACTICES
PROJECT
SUBJECT CODE- 065
1
GROUP MEMBERS
✓ VANSH KUMAR
✓ AMAN PRATAP SINGH
SUBMITTED BY - VANSH KUMAR
CLASS -12 ‘A’
ROLL NO. – 26
SUBJECT TEACHER – MR. JAGDISH SIR
2
This is to certify that the project/Dissertation
Entitled
LIBRARY MANAGEMENT is a bonafide work done by Vansh Kumar
of Class XII Session 2020-2021 in partial fulfillment of CBSE’s BOARDS
Examination 2020-2021 and has been carried out under my direct
supervision and guidance.
This report or a similar report on the topic has not been submitted for
any other examination and does not form a part of any other course
undergone by the candidate.
…………………….. …………………………
Signature of Teacher Signature of Principal
Name: JAGADISH KR YADAV Name: VINCENT PIRERA
…………………………..
Signature of Examiner
DATE : …………………………..
3
INDEX
➢ Acknowledgement
➢ Mysql Database Screenshot
➢ Python File
• Main File
• libsubmenu
• libbooksrecord
• updatelib
• vanshlib
➢ Sample Output Screenshot
➢ Bibliography
➢ Conclusion
4
ACKNOWLEDGEMENT
I undertook this project work, as the part of my XII-Informatics
practices course. I had tried to apply my best of knowledge and
experience gained during the study and class work experience.
However, developing software system is generally a quite
complex and time-consuming process. It requires a systematic
study, insight vision and professional approach during the
design and development.
Moreover, the developer always feels the need, the help and
good wishes of the people near you, who have considerable
experience and idea.
I would like to extend my sincere thanks and gratitude to my
teacher MR. JAGADISH KUMAR YADAV.
I also feel indebted to my friends for the valuable suggestions
during the project work.
VANSH KUMAR
CLASS XII
5
Mysql
database
6
PYTHON FILE
Main File
import libsubmenu
print("======================================================")
print(" LIBRARY MANAGEMENT ")
print("======================================================")
while True:
try:
print('Press 1 for login')
print('press 2 for exit')
print("======================================================")
ch=input('enter your choice: ')
if ch=='1':
def pswd():
ps=input("Enter Password : ")
if ps=="aman":
libsubmenu.main()
else:
print("Wrong Password *__*")
pswd()
def userid():
7
us=input("Enter User ID : ")
if us=="aman":
pswd()
else:
print("Ooops Wrong User ID")
userid()
userid()
elif ch=='2':
break
else:
print('Wrong input')
print("======================================================")
except Exception as e:
print(e)
8
libsubmenu
#importing pandas
import pandas as pd
#for importing vanshlib file
import Vanshlib
#for importing libbooksrecord
import libbooksrecord
#for defining main function
def main():
print("======================================================")
#sub menu
while True:
#for handling error
try:
print("Press 1 to get books record")
print("Press 2 to issues books")
print("Press 3 to submit books")
print("Press 4 to previous menu")
print("======================================================")
ch=input("Enter your choice")
print("======================================================")
if ch=="1":
#books record
libbooksrecord.main()
elif ch=="2":
#issues books
Vanshlib.main()
9
elif ch=="3":
#submit books
Vanshlib.main()
elif ch=="4":
#previous menu
break
else:
#for wrong input
print("Wrong input")
print("======================================================")
except Exception as e:
print(e)
10
libbooksrecord
#importing pandas library for dataframe
import pandas as pd
#importing mysql.connector for connection
import mysql.connector as sqltor
#importing updatelib file to update
import updatelib
#for establishing connection with mysql database
mycon=sqltor.connect(host='localhost',user='root',passwd='chunar@123',
database='vanshlib')
mycursor=mycon.cursor()
#defining main function
def main():
while True:
#for heldling error
try:
print('press 1 to add book record:')
print('press 2 to delete book record:')
print('press 3 to view book record:')
print('press 4 to update book record:')
print('press 5 to previous menu:')
print("======================================================")
ch=input("Enter the choice: ")
print("======================================================")
# To add books record
if ch=='1':
#calling addb function
11
addb()
a=input("Press enter key to continue")
# To delete books record
elif ch=='2':
Book_Code=input("Enter Book_Code which you want to delete: ")
query="delete from books_record where Book_Code='{}'"
mycursor.execute(query.format(Book_Code,))
print("======================================================")
print(" Book record is deleted
")
print("======================================================")
#for saving the records
mycon.commit()
a=input("Press enter key to continue")
# To view books record
elif ch=='3':
query=("select *from books_record")
mycursor.execute(query)
ss=mycursor.fetchall()
df=pd.DataFrame(ss,columns=['Name of
book','Edition','Publisher','Book_Code','Author','Price','Number of books'])
#for displaying record
print(df)
a=input("Press enter key to continue")
elif ch=='4':
#calling function to update books record
updatelib.main()
elif ch=='5':
#To go in previous menu
break
else:
#if wrong input
12
print("======================================================")
print(" Wrong Input Try Again! ")
print("======================================================")
except Exception as e:
print(e)
#defining function for adding book record
def addb():
name=input('Enter name of books :')
Book_Code=input('enter Book_Code of book: ')
author=input("enter author's name :")
publisher=input("enter book publisher's name :")
edition=input('enter book edition year in (YYYY-MM-DD) : ')
price=int(input('enter book price :'))
book_number=int(input('enter number of books : '))
#creating query
query="select Book_Code from books_record where Book_Code='{}'"
mycursor.execute(query.format(Book_Code,))
bnb=mycursor.fetchone()
if bnb[0]==Book_Code:
#ceating query to update
query="update books_record set book_number=book_number+{}
where Book_Code='{}'"
mycursor.execute(query.format(book_number,Book_Code))
print("======================================================")
print(" Book number is updated")
print("======================================================")
#for saving
mycon.commit()
else:
query="insert into books_record values('{}','{}','{}','{}','{}',{},{})"
13
mycursor.execute(query.format(name,edition,publisher,Book_Code,autho
r,price,book_number))
print("======================================================")
print(" Book record is added ")
print("======================================================")
#for saving the records
mycon.commit()
14
updatelib
#updation
#importing pandas
import pandas as pd
#importing sql
import mysql.connector as sqltor
#establishing connection
mycon=sqltor.connect(host='localhost',user='root',passwd='chunar@123',
database='vanshlib')
#creating cursor
mycursor=mycon.cursor()
#for defining main function
def main():
while True:
#For handling error
try:
# for updation
print('Press 1 to update name of book : ')
print('Press 2 to update author name : ')
print('Press 3 to update publisher name : ')
print('Press 4 to update edition year : ')
print('Press 5 to update price : ')
print('Press 6 to update number of books : ')
print('press 7 to previous menu')
print("======================================================")
#to enter option
option=input("Enter the option")
print("======================================================")
15
if option=='1':
#book name
Book_Code=input("Enter Book_Code of the book you want to
update")
newname=input("Enter new name : ")
query="update books_record set name_of_books='{}' where
Book_Code='{}' "
mycursor.execute(query.format(newname,Book_Code))
print("======================================================")
print("======================================================")
print(" Book name is updated ")
print("======================================================")
print("======================================================")
#for saving
mycon.commit()
a=input("Press enter key to continue")
elif option=='2':
#author name
Book_Code=input("Enter Book_Code of the book you want to
update")
newauthorname=input("Enter new author name : ")
query="update books_record set author='{}' where
Book_Code='{}'"
mycursor.execute(query.format(newauthorname,Book_Code))
print("======================================================")
print("======================================================")
print(" Book author name is updated
")
16
print("======================================================")
print("======================================================")
#for saving
mycon.commit()
a=input("Press enter key to continue")
elif option=='3':
#publisher name
Book_Code=input("Enter Book_Code of the book you want to
update")
newpubname=input("Enter new publisher name : ")
query="update books_record set published_by ='{}'where
Book_Code='{}'"
mycursor.execute(query.format(newpubname,Book_Code))
print("======================================================")
print("======================================================")
print(" Book publisher name is updated
")
print("======================================================")
print("======================================================")
#for saving
mycon.commit()
a=input("Press enter key to continue")
elif option=='4':
#edition year
Book_Code=input("Enter Book Code of the book you want to
update")
newedition=input("Enter new edition : ")
query="update books_record set edition='{}' where
Book_Code='{}'"
17
mycursor.execute(query.format(newedition,Book_Code))
print("======================================================="
)
print("======================================================")
print(" Book edition year is updated
")
print("======================================================")
print("======================================================")
#for saving
mycon.commit()
a=input("Press enter key to continue")
elif option=='5':
#price
Book_Code=input("Enter Book_Code of the book you want to
update")
newprice=int(input("Enter new price : "))
query="update books_record set price ={} where Book_Code='{}'"
mycursor.execute(query.format(newprice,Book_Code))
print("======================================================")
print("======================================================")
print(" Book price is updated
")
print("======================================================")
print("======================================================")
#for saving
mycon.commit()
a=input("Press enter key to continue")
18
elif option=='6':
#To update number of books
Book_Code=input("Enter Book_Code of the book you want to
update")
book_number=int(input("Enter new number of books : "))
query="update books_record set book_number ={} where
Book_Code='{}'"
mycursor.execute(query.format(book_number,Book_Code))
print("======================================================")
print("======================================================")
print(" number of books is updated ")
print("======================================================")
print("======================================================")
#for saving
mycon.commit()
a=input("Press enter key to continue")
elif option=='7':
#Previous menu
break
else:
#for wrong input
print("Wrong Input Try Again!")
print("======================================================")
a=input("Press enter key to continue")
except Exception as e:
print(e)
19
vanshlib
import pandas as pd
import mysql.connector as a
con=a.connect(host="localhost",user="root",passwd="chunar@123",datab
ase="vanshlib")
#defining function to issue the book
def issueb():
n=input("Enter the Name of Student :")
r=input("Enter the Reg No of Student :")
query=("select *from books_record")
c=con.cursor()
c.execute(query)
ss=c.fetchall()
df=pd.DataFrame(ss,columns=['Name of
book','Edition','Publisher','Book_Code','Author','Price','Number of books'])
#for displaying record
print(df)
co=input("Enter the Book Code :")
d=input("Enter Date :")
a="select book_number from books_record where Book_Code='{}'"
c.execute(a.format(co,))
myresult=c.fetchone()
if myresult[0]>0:
a="insert into ISSUES values('{}','{}','{}','{}')"
data=(n,r,co,d)
c.execute(a.format(n,r,co,d))
con.commit()
print("======================================================")
print("Book issued to :",n)
20
bookup(co,-1)
else:
print("======================================================")
print("Book is not available")
#defining function to submit book
def submitb():
n=input("Enter the Name of Student :")
r=input("Enter the Reg No of Student :")
co=input("Enter the Book Code :")
d=input("Enter Date :")
a="insert into SUBMIT values('{}','{}','{}','{}')"
c=con.cursor()
c.execute(a.format(n,r,co,d))
con.commit()
bookup(co,1)
print("======================================================")
print("Book Submited :",n)
a="delete from ISSUES where Stud_Name='{}'"
c.execute(a.format(n,))
con.commit()
#for book no. update
def bookup(cd,bn):
a="select book_number from books_record where Book_Code='{}'"
c=con.cursor()
c.execute(a.format(cd,))
myresult=c.fetchone()
t=myresult[0] + bn
sql="update books_record set book_number={} where Book_Code='{}'"
c.execute(sql.format(t,cd))
con.commit()
#defining function to display issues table
def dispissues():
21
a="select * from ISSUES"
c=con.cursor()
c.execute(a)
myresult=c.fetchall()
for i in myresult:
print("Student Name :",i[0])
print("Reg No :",i[1])
print("Book Code :",i[2])
print("Date of Issue :",i[3])
print("======================================================")
#defining function to display submit table
def dispsubmit():
a="select * from SUBMIT"
c=con.cursor()
c.execute(a)
myresult=c.fetchall()
for i in myresult:
print("Student Name :",i[0])
print("Reg No :",i[1])
print("Book Code :",i[2])
print("Date of Submit :",i[3])
print("======================================================")
#defining function of main
def main():
while True:
try:
print('''|------------------------------------------------------------------------
--------------------------|
1. ISSUE BOOKS
|--------------------------------------------------------------------------------------------------
|
2. SUBMIT BOOK
22
|--------------------------------------------------------------------------------------------------
|
3. DISPLAY ISSUES
|--------------------------------------------------------------------------------------------------
|
4. DISPLAY SUBMISSION
|--------------------------------------------------------------------------------------------------
|
5. PREVIOUS MENU
|--------------------------------------------------------------------------------------------------
|''')
Choice=input("Enter Task No :")
print("|-------------------------------------------------------------------------
-------------------------|")
if Choice=='1':
print("|-------------------------------------------------------------------
-------------------------------|")
issueb()
print("|-------------------------------------------------------------------
-------------------------------|")
a=input("Press enter key to continue")
elif Choice=='2':
print("|-------------------------------------------------------------------
-------------------------------|")
submitb()
print("|-------------------------------------------------------------------
-------------------------------|")
a=input("Press enter key to continue")
elif Choice=='3':
print("|-------------------------------------------------------------------
-------------------------------|")
dispissues()
print("|-------------------------------------------------------------------
-------------------------------|")
a=input("Press enter key to continue")
23
elif Choice=='4':
print("|-------------------------------------------------------------------
-------------------------------|")
dispsubmit()
print("|-------------------------------------------------------------------
-------------------------------|")
a=input("Press enter key to continue")
elif Choice=="5":
break
else:
print("|-------------------------------------------------------------------
-------------------------------|")
print("=======================================================
=========")
print("Wrong Choice.........")
print("=======================================================
=========")
print("|-------------------------------------------------------------------
-------------------------------|")
except Exception as e:
print(e)
24
SAMPLE
OUTPUT
25
BIBLIOGRAPHY
In order to work on this project titled “LIBRARY
MANAGEMENT”, the following websites and books are
referred by me during the various phases of development of
the project.
(1) http://www.mysql.org/
(2) http://www.python.org/
(3) INFORMATICS PRACTICES FOR CLASS XII
-BY SUMITA
ARORA
Other than the above-mentioned books, the suggestions and
supervision of my teacher and my class experience also helped
me to develop this software project.
26
CONCLUSION
Here I have come to the end of the IP Project on Python & Mysql.
Its been a great opportunity for me to be on this amazing project.
I learned a lot about coding in Python & creating and manipulating
databases in Mysql.
This project is specially designed to make the day to day task in
management of books and students’ record in library much much
easier , faster and organized.
Hoping that this project would help teachers and officials in
managing library records.
Thank You
27