[go: up one dir, main page]

0% found this document useful (0 votes)
79 views22 pages

Source Code

This document describes a library management system built using Python and MySQL. It includes details on the tables used to store book, issue, and return data. It also provides the source code and functions for connecting to the database, adding/retrieving books, issuing/returning books, and updating book counts.

Uploaded by

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

Source Code

This document describes a library management system built using Python and MySQL. It includes details on the tables used to store book, issue, and return data. It also provides the source code and functions for connecting to the database, adding/retrieving books, issuing/returning books, and updating book counts.

Uploaded by

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

lOMoARcPSD|42400624

Library Management System Using Python AND MY SQL

Computer science (Gandhi Institute for Technological Advancement)

Scan to open on Studocu

Studocu is not sponsored or endorsed by any college or university


Downloaded by Prad Hap (phap79234@gmail.com)
lOMoARcPSD|42400624

LIBRARY
MANAGEMENT
SYSTEM
Using Python and mySQL

GANDHI INSTITUTE OF TECHNOLOGICAL ADVANCEMENT (GITA),


BHUBANESWAR, ODISHA-752054, INDIA

Downloaded by Prad Hap (phap79234@gmail.com)


lOMoARcPSD|42400624

LIBRARY MANAGEMENT SYSTEM USING


PYTHON AND MY SQL

Project ID: xxxxxx


A Mini Project Report
Submit for fulfilment of the requirements for the
Degree of Bachelor of Technology
Under GITA Autonomous College, Bhubaneswar

Submitted By

Susil Kumar Sahu


Roll No: #CSIT2105058
Prabhupada Nayak
Roll No: #CSIT2105035

May- 2023

Under the guidance of

Dr. Parimal Kumar Giri

Downloaded by Prad Hap (phap79234@gmail.com)


lOMoARcPSD|42400624

GANDHI INSTITUTE OF TECHNOLOGICAL ADVANCEMENT


(GITA), BHUBANESWAR, ODISHA-752054, INDIA

CERTIFICATE
This is to certify that the project work entitled ‘LIBRARY MANAGEMENT SYSTEM
USING PYTHON AND MY SQL xxxxxx’ is a bonafide work being SUSIL KUMAR
SAHU and PRABHUPADA NAYAK bearing Registration No. #2101287387 and
Registration No. #2101287366 of B. Tech CSIT branch.

This project report is submitted in partial fulfillment for the requirement of the B.Tech degree
under Gandhi Institute of Technological Advancement (GITA), Bhubaneswar, Odisha.

Project Coordinator Date Project Guide

Downloaded by Prad Hap (phap79234@gmail.com)


lOMoARcPSD|42400624

Acknowledgem
ent
I would like to take this opportunity to thank all those individuals whose invaluable
contribution in a direct or indirect manner has gone into the making of this mini project a
tremendous learning experience for me.

It is my proud privilege to epitomize my deepest sense of gratitude and indebtedness to my


faculty guide, Prof. / Dr. xyz for his valuable guidance, keen and sustained interest, intuitive
ideas and persistent endeavour. His guidance and inspirations enabled me to complete my
report work successfully.

I give my sincere thanks to Prof./Dr. xyz, Project Coordinator and Dr. Parimal Kumar Giri,
HOD CSIT for giving me the opportunity and motivating me to complete the project within
stipulated period of time and providing a helping environment.

I acknowledge with immense pleasure the sustained interest, encouraging attitude and
constant inspiration rendered by Prof. (Dr.) M.K. Roul (Principal), GITA Autonomous.
Their continued drive for better quality in everything that happens at GITA and selfless
inspiration has always helped us to move ahead.

Downloaded by Prad Hap (phap79234@gmail.com)


lOMoARcPSD|42400624

Susil Kumar Sahu


Prabhupada Nayak

PROJECT ON
LIBRARY MANAGEMENT
SYSTEM
2021-25

Group members:

Downloaded by Prad Hap (phap79234@gmail.com)


lOMoARcPSD|42400624

• Susil Kumar
Sahu
•Pra
bhupada Nayak

INDEX
Particulars Page
Sl.no.
1 06
Project Analysis

2 Functions and modules 07

3 Detailed Description 10
4 Source Code 11
5 Outputs And Tables 15
6 Bibliography 18
remarks 19
7

Downloaded by Prad Hap (phap79234@gmail.com)


lOMoARcPSD|42400624

Downloaded by Prad Hap (phap79234@gmail.com)


lOMoARcPSD|42400624

PROJECT ANALYSIS
Our application program is specially
designed for the public library named
"READING COMMUNITY."

They lend books to readers who have subscribed


with the library.

We have tried to maximise the efficiency and strived for customer and
user ease as well as satisfaction.

We have thoroughly examined the needs of the library and after the
analysis, we have constructed the program.

We have used PYTHON and MYSQL as our platform

to carry out this task.

Downloaded by Prad Hap (phap79234@gmail.com)


lOMoARcPSD|42400624

functions and modules

modules:

import mysql.connector:

By importing this package,we are able to establish the


connection between SQL and PYTHON.

Downloaded by Prad Hap (phap79234@gmail.com)


lOMoARcPSD|42400624

FUNCTIONS:

connect():
This function establishes connection between Python
andMySQL.

cursor():
It is a special control structure that facilitates the row-by- row
processing of records in the result set.
The Syntax is:
<cursor object>=<connection object>.cursor()

execute():
This function is used to execute the sql query and retrieve
records using python.
The syntax is:
<cursor object>.execute(<sql query string>)

def():
A function is a block of code which only runs when it is
called.

Downloaded by Prad Hap (phap79234@gmail.com)


lOMoARcPSD|42400624

fetchall():
This function will return all the rows from the result set in the
form of a tuple containing the records.
fetchone():
This Function will return one row from the result set in the
form of a tuple containing the records.
commit():
This function provides changes in the database physically.

Downloaded by Prad Hap (phap79234@gmail.com)


lOMoARcPSD|42400624

DETAILED
DESCRIPTION

*) Our Project has 3 MySQL tables. These are:-


1.) Books
2.) Issue
3.) Submit
1) The table Books contain the following columns:
a) bname
b) bcode
c) total
d) subject
2.) The table Issue contain the following columns:
a.) name
b.) regno
c.) bcode
d.) issue_date
3.) The table Return contain the following columns:
a.) name
b.) regno
c.) bcode
d.) submit_date

Downloaded by Prad Hap (phap79234@gmail.com)


lOMoARcPSD|42400624

source code
for mysql:

Downloaded by Prad Hap (phap79234@gmail.com)


lOMoARcPSD|42400624

Source code
For python:
import mysql.connector as a
con=a.connect(host="localhost",user="root",passwd="Susil@1@2@3",database="libr
ary1")

def addbook():
bn=input("enter the book name : ")
c=input("enter the book code : ")
t=input("total book : ")
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 ENTERED SUCCESSFULLY")
main()
def issueb():
n=input("enter the name : ")
r=input("enter the reg no : ")
co=input("enter book code : ")
r=input("enter the reg no : ")
d=input("enter date : ")
a="insert into issue values(%s,%s,%s,%s)"
data=(n,co,r,d)
c=con.cursor()
c.execute(a,data)
con.commit()
print(">---------------------------------------------------------------<")
print("Book Issued To :",n)
bookup(co,-1)
def submitb():
n=input("enter the name : ")
r=input("enter the reg no : ")
co=input("enter book code : ")
d=input("enter date : ")
data=(n,r,co,d)
a='insert into submit values(%s,%s,%s,%s)'
c=con.cursor()
c.execute(a,data)
con.commit()

Downloaded by Prad Hap (phap79234@gmail.com)


lOMoARcPSD|42400624

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()
c.execute(a,data)
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 dbook():
ac=input("enter book code")
a="delete from books where BCODE=%s"
data=(ac,)
c=con.cursor()
c.execute(a,data)
con.commit()
main()
def dispbook():
a="select* from books"
c=con.cursor()
c.execute(a)
myresult=c.fetchall()
for i in myresult:
print("book name : ",i[0])
print("book code : ",i[1])
print("total : ",i[2])
print(">---------------------------------------------------------<")
main()
def main():
print("""

LIBRARY MANAGER

1.ADD BOOK
2.ISSUE BOOK
3.SUBMIT BOOK
4.DELETE BOOK
5.DISPLAY BOOKS
""")

choice=int(input("Enter Task No : "))

Downloaded by Prad Hap (phap79234@gmail.com)


lOMoARcPSD|42400624

print(">----------------------------------------------------------------
<")
if(choice==1):
addbook()
elif(choice==2):
issueb()
elif(choice==3):
submitb()
elif(choice==4):
dbook()
elif(choice==5):
dispbook()
else:
print("wrong choice.........")
main()
def pswd():
ps=input("enter password : ")
if(ps=="Susil@1@2@3"):
main()
else:
print("Wrong password")
pswd()
pswd()

Downloaded by Prad Hap (phap79234@gmail.com)


lOMoARcPSD|42400624

outputs and tables


Outputs:
1.)Add a book:

2.)issue a book:

Downloaded by Prad Hap (phap79234@gmail.com)


lOMoARcPSD|42400624

3.)Submit the book:

4.)delete the book:

Downloaded by Prad Hap (phap79234@gmail.com)


lOMoARcPSD|42400624

5.)display the books:

TABLES:
1.)select * from books:

2.)select * from issue:

3.)select * from submit:

Downloaded by Prad Hap (phap79234@gmail.com)


lOMoARcPSD|42400624

BIBLIOGRAPHY
 To develop this project many
references are used
1.https://youtube.com
2.https://google.com

Downloaded by Prad Hap (phap79234@gmail.com)


lOMoARcPSD|42400624

Remark

Downloaded by Prad Hap (phap79234@gmail.com)

You might also like