0% found this document useful (0 votes)
10 views12 pages

Project Library - 1

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views12 pages

Project Library - 1

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 12

JAWAHAR NAVODAYA VIDYALAYA

WEST JAINTIA HILLS : MEGHALAYA

AISSCE-2020-21

“INFORMATICS PRACTICES”

BASED ON

LIBRARY MANAGEMENT SYSTEM


SUBMITTED BY-
DYNAMIC SNA – 16630028

ESUK KI MYRBOH – 16630029

FIRSTRIWELL SYMPLI – 16630031

HAMEJURBAIT PHAWA- 16630032

GUIDED BY-

Mr. SUSHIL KUMAR


(PGT Comp. Sci.)
CERTIFICATE

This is to certify that:


DYNAMIC SNA – 16630028

ESUK KI MYRBOH – 16630029

FIRSTRIWELL SYMPLI – 16630031

HAMEJURBAIT PHAWA- 16630032

Who has prepared a project based LIBRARY MANAGEMENT SYSTEM as a


partial fulfilment for Informatics Practices practical AISSCE 2021 under my
guidance. This project prepared by them is satisfactory.

SUSHIL KUMAR
PGT (Comp. Sci.)
ACKNOWLEDGEMENT

We take this opportunity to express our sincere gratitude to all those


who helped us in various capacities in undertaking this project and
devising the report

First of all we would like to thank Mr SUSHIL MKUMAR, PGT


(Comp. Sc.) who extended his help and guidance us in every matter of
this project work. We also thanks to my friends who help us in every
aspect of this project work. We finally extend our sincere thanks to
our honourable Principal Sir who support us in every field of
education.
'''
Project : Library Book Record Management System
Softwares : MySQL & Python 3.8.5(IDLE), Pydroid 3
Team Members :

Databse name : library


Table name : book

Structure of table book :

bno integer - Book's Number Primary Key


bname varchar(30) - Book's Name
bauth varchar(40) - Book's Author
bprice integer - Book's Price
bqty integer - Book's Quantity

Pre requirements for the project :

1. softwares- Python 3.8.5 & Mysql must be installed on system.


2. Database "library" must exists on system
3. Table "book" must be exists in database "library"

'''

'''
# Code for creating database- library [Must be executed only ONCE]

import mysql.connector as sqlcon

mycon= sqlcon.connect(host="localhost", user="root", passwd="1234")


if mycon.is_connected():
print("databse connected successfully")
mycur=mycon.cursor()
qry="CREATE DATABASE library"
mycur.execute(qry)
print("Database created successfully")
'''

'''
# Code for creating table - book in the database- library [Must be executed
only ONCE]

import mysql.connector as sqlcon

mycon= sqlcon.connect(host="localhost", user="root", passwd="1234",


database="library")

mycur=mycon.cursor()

mycur.execute("CREATE TABLE book(bno integer primary key, bname


varchar(50), bauth varchar(50), bprice integer, bqty integer)")
print("Table created successfully")
'''

# MySQL Databse connection

import mysql.connector as sqlcon

mycon= sqlcon.connect(host="localhost", user="root", passwd="1234",


database="library")

if mycon.is_connected():
print("Connected to MYSQL database successfully")
mycur= mycon.cursor()

# function to insert book record


def insertbook():
bno=int(input("Enter Book Code:"))
bname=input("Enter Book Name:")
bauth=input("Enter Book Author:")
bprice=int(input("Enter Book Price:"))
bqty=int(input("Enter Book Quantity:"))

qry="INSERT INTO book VALUES(%s,%s,%s,%s,%s)"


data=(bno,bname,bauth,bprice,bqty)
mycur.execute(qry,data)
mycon.commit()
print("\t\tRecord ADDED successfuly...")
# Function to display book record
def displaybook():
qry="SELECT * FROM book"
mycur.execute(qry)
data=mycur.fetchall()
count=mycur.rowcount
print("\t\t Total Book Records.........:",count,"\n")

for (bno,bname,bauth,bprice,bqty) in data:


print("Book Code:\t",bno)
print("Book Name:\t",bname)
print("Book Author:\t",bauth)
print("Book Price:\t",bprice)
print("Book Quantity:\t",bqty)
print(".................................")

# function to search book record


def searchbook():
bno=int(input("Enter book number to be searched...:"))
qry="SELECT * FROM book WHERE bno=%s"
rec=(bno,)
mycur.execute(qry,rec)
data=mycur.fetchall()
count=mycur.rowcount
if count!=0:
print("\t\t Book Records found.........:\n")
for (bno,bname,bauth,bprice,bqty) in data:
print("Book Code:\t",bno)
print("Book Name:\t",bname)
print("Book Author:\t",bauth)
print("Book Price:\t",bprice)
print("Book Quantity:\t",bqty)
print(".................................")

else:
print("\t\t\t Record NOT found..!!!")

# function to delete book record


def deletebook():
bno=int(input("Enter book number to be deleted...:"))
qry="SELECT * FROM book WHERE bno=%s"
rec=(bno,)
mycur.execute(qry,rec)
data=mycur.fetchall()
count=mycur.rowcount

if count!=0:
print("\t\t Book Records found.........:\n")
for (bno,bname,bauth,bprice,bqty) in data:
print("Book Code:\t",bno)
print("Book Name:\t",bname)
print("Book Author:\t",bauth)
print("Book Price:\t",bprice)
print("Book Quantity:\t",bqty)
print(".................................")

opt=input("Are you SURE to DELETE above record (Y/N)...:")


if opt=="Y" or opt=="y" :
qry= "DELETE FROM book WHERE bno=%s"
rec=(bno,)
mycur.execute(qry,rec)
print("\n\t\tRecord deleted Successfully...... ")
mycon.commit()

else:
print("\t\t\t Record NOT found..!!!")

# function to update book record


def updatebook():
bno=int(input("Enter book number to be updated...:"))
qry="SELECT * FROM book WHERE bno=%s"
rec=(bno,)
mycur.execute(qry,rec)
data=mycur.fetchall()
count=mycur.rowcount

if count!=0:a
print("\t\t Book Records found.........:\n")
for (bno,bname,bauth,bprice,bqty) in data:
print("Book Code:\t",bno)
print("Book Name:\t",bname)
print("Book Author:\t",bauth)
print("Book Price:\t",bprice)
print("Book Quantity:\t",bqty)
print(".................................")

opt=input("Are you SURE to UPDATE above record (Y/N)...:")


if opt=="Y" or opt=="y" :
print ("\n\t\tEnter new Data....")
bname=input("Enter New Book Name:")
bauth=input("Enter New Book Author:")
bprice=int(input("Enter New Book Price:"))
bqty=int(input("Enter New Book Quantity:"))

qry= ("UPDATE book SET bname=%s,bauth=%s,bprice=


%s,bqty=%s WHERE bno=%s")
rec=(bname,bauth,bprice,bqty,bno)
mycur.execute(qry,rec)
print("\n\t\tRecord Updated Successfully...... ")
mycon.commit()

else:
print("\t\t\t Record NOT found..!!!")

# code to display menu


while True :
print("\n\t\t LIBRARY BOOK RECORD MANAGEMENT\n")
print("==================================")
print("\t\t 1. Add New Book record")
print("\t\t 2. Display Book record")
print("\t\t 3. Search Book record")
print("\t\t 4. Delete Book record")
print("\t\t 5. Update Book record")
print("\t\t 6. EXIT")
print("==================================")
choice=int(input("Enter choice 1-6:"))
if choice==1:
insertbook() # function called for inserting book
elif choice==2:
displaybook() # function called for displaying records of book(s)
elif choice==3:
searchbook() # function called for searching book
elif choice==4:
deletebook() # function called for deleting book
elif choice==5:
updatebook() # function called for updating book record
elif choice==6:
mycon.close()
print("\n Thanks have a nice day.........")
break
else :
print("\t!!!wrong choice... please enter choice 1-6:")

You might also like