Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 19

1

INDEX

1. CERTIFICATE
2. ACKNOWLEDGEMENT
3. MYSQL CODING
4.PYTHON CODING
5.SOFTWARE AND HARDWARE
REQUIREMENT
5. OUTPUT
2

CERTIFICATE
CLASS: 12TH A YEAR: 2022-
2023

This is to certify that LIBRARY MANAGEMENT


PROJECT is successfully completed by Sambhav
upreti of Class: 12th A Roll no. 37 for the academic
year 2022-2023.

Head Teacher :Mrs. Kajol


External Examiner :
Internal Examiner :
Date : 16/10/2022

Principal
3

Acknowledgement
I, Sambhav upreti of class 12th A would like to
express my sincere gratitude to our computer
science teacher Mrs. Kajol,COMPUTER SCIENCE,
for her vital support, guidance and
encouragement – without which
this project would not have come forth.

LIBRARY MANAGEMENT SYSTEM


This project is made using two python scripts
First ( MYSQL ) : coding for making tables in mysql server.
4

We will write python code for making tables and database in


mysql server. We will use python mysql connectivity for this. After
writing the code we will execute this script only once. And after
executing all the tables and database will be created in the server.
Second ( PYTHON IDLE ) : coding for using project interface.
Now we have made our database in mysql server using python
idle. So now we will write the python code so that we can insert
and access data from our database. We will create several
functions for our interface of project. These functions will drive the
working of our project / system.

MYSQL
We will create a database “l1” and in that we will create 3 tables.
import mysql.connector as a
5

con = a.connect(host="localhost",
user="root",
passwd="12345")
c = con.cursor()
sql1 = "create database l1"
c.execute(sql1)
sql2 = "use l1"
c.execute(sql2)
sql3 = "create table books (bname varchar(50),bcode varchar(10),
total int, subject varchar(50))"
c.execute(sql3)
sql4 = "create table issue (sname varchar(50),regno varchar(10),
bcode varchar(10), idate varchar(10))"
c.execute(sql4)
sql5 = "create table submit (sname varchar(50), regno varchar(10),
bcode varchar(10), sdate varchar(10))"
c.execute(sql5)
con.commit()
6

PYTHON IDLE
import mysql.connector as a
con = a.connect
(host="localhost",user="root
",passwd="12345",database
="l1")

def addbook():
bn = input("Enter BOOK Name : ")
c = input("Enter BOOK Code : ")
t = input("Total Books : ")
s = input("Enter Subject : ")
data = (bn,c,t,s)
sql = 'insert into books values(%s,%s,%s,%s)'
c = con.cursor()
c.execute(sql,data)
con.commit()

print(">

<")
print("Data
7

main()

def issueb():
n = input("Enter Name : ")
r = input("Enter Reg No : ")
co = input("Enter Book Code : ")
d = input("Enter Date : ")
a = "insert into issue values(%s,%s,%s,%s)"
data = (n,r,co,d)
c = con.cursor()
c.execute(a,data
) con.commit()

print(">

<")
print("Book issued to : ",n)
bookup(co,-1)

def submitb():
8

n = input("Enter Name : ")


r = input("Enter Reg No : ")
co = input("Enter Book Code : ")
d = input("Enter Date : ")
a = "insert into submit values(%s,%s,%s,%s)"
data = (n,r,co,d)
c = con.cursor()
c.execute(a,data
) con.commit()

print(">

<")
print("Book Submitted from : ",n)
bookup(co,1)

def bookup(co,u):
a = "select TOTAL from books where BCODE = %s"
data = (co,)
c = con.cursor()
9

c.execute(a,data) #
(10,) myresult =
c.fetchone()
t = myresult[0] + u
sql = "update books set TOTAL = %s where BCODE = %s"
d = (t,co)
c.execute(sql,d)
con.commit()
main()

def rbook():
ac =
input("Enter
Book Code : ")
a = "delete from books where BCODE = %s"
data = (ac,)
c = con.cursor()
c.execute(a,data
) con.commit()
main()
10

a = "select * from books"


c = con.cursor()
c.execute(a)
myresult = c.fetchall() # [(1,2,3,4),(1,2,3,4)]
for i in myresult:
print("Book Name : ",i[0])
print("Book Code : ",i[1])
print("Total : ",i[2])
print("Subject : ",i[3])
print("> <") main()

def ibooks():
a = "select * from issue"
c = con.cursor()
c.execute(a)
myresult = c.fetchall() # [(1,2,3,4),(1,2,3,4)]
for i in myresult:
print("Student
Name : ",i[0])
11

print("Reg No : ",i[1])
print("Book Code : ",i[2])
print("Issue Date : ",i[3])
print("> <") main()

def main():

print("""
L
I
B
1. ADD 2. ISSUE R3. SUBMIT 4. REMOVE
A 5.
DISPLA R
Y Y
""") M
choice A
= N
input A
("Ent G
er E
Task R
No :
")
12

elif (choice=='2'):
issueb()
elif (choice=='3'):
submitb()
elif (choice=='4'):
rbook()
elif (choice=='5'):
print("1. All 2. Issued")
ch = input("Enter Task No.
")

print(">

<")
if ch == '1':
dispbook()
else:
ibook
s()
else :
print(" Wrong
choice..........") main()
13

def pswd():
ps = input("Enter Password : ")
if ps == "py143":
main()
else:
print("Wrong
Password") pswd()
pswd()
14

SOFTWARE AND HARDWARE


REQUIREMENTS
Software Requirements :
Mysql server : mysql server must be installed in computer. It
will be used for accessing data of project. Tables will be
made in server in which data will be stored.
Python idle : python idle must be installed in computer. It
will be used for executing python scripts.
Mysql.connector : it will connect python idle with mysql
server. To install it open cmd and write pip install
mysql.connector

Hardware Requirements:
Computer must be of 500 gb hard-disk , intel i3 processor
and 8 gb ram (minimum)
15

OUTPUT SCREENS
16
17
18
19

You might also like