0% found this document useful (0 votes)
19 views26 pages

Prisha - Ip

Uploaded by

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

Prisha - Ip

Uploaded by

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

COMPUTER SCIENCE INVESTIGATORY

PROJECT

NAME – Prisha Mathur


CLASS – XII-A
BOARD ROLL NO. -
GUIDED BY – Ms. Shagufa Khan
SCHOOL – St. Xavier’s High School
INDEX

SR.NO TOPIC PAGE NO

01 Declaration 1

02 Acknowledgement 2

03 Introduction 3

04 Working Procedure 4

05 Functions and Modules 5-6

06 Detailed Description 7-8

07 Source Code 9-12

08 Output 13-17

09 Bibliography 18
DECLARATION

I Prisha Mathur solemnly declare that the investigatory project titiled


“Library Management System” is based on my own work carried
out during the course of our study under the guidance of Ms.Shagufa
Khan . I assert that the statements made in this project are based on
the results of my own research, analysis and experimentation. I
further certify that all the coding is the result of my personal efforts.

I also acknowledge that any external assistance received during the


project is duly credited in the bibliography.

Ms Prisha Mathur

1
ACKNOWLEDGEMENT

I would like to express a deep sense of gratitude to my project guide


Ms.Shagufa Khan for her unwavering support and guidance
throughout the course of this project. Her expertise, patience and
encouragement were instrumental in the successful completion of this
endeavour. I am truly thankful for the knowledge and skills I have
gained under her mentorship.

I extend my heartfelt appreciation to our esteemed Principal


Mrs.Salma Pathan for her encouragement. Her commitment to
fostering a culture of curiosity within our school has played a pivotal
role in the completion of this project.

Finally, I extend my gratefulness to my parents for their motivation


and support. Their constant belief in my abilities and their emotional
support were instrumental to my success

2
INTRODUCTION

Library Management System is a software system where the


management of entire library is computerized. This system is
designed using Python as front end and MySQL as the secured
backend database. In this project the details are maintained like book
details, issued and returned books, available stock of books,etc. All
these processes are computerized and the management is done
without any difficulty.

Using the library management system, the following activities can be


performed:
Issue and return books, add or delete books and display the available
books.

The aim of this project is to facilitate easy management and


administration of a library.Using the automated library management
software. One can keep detailed records or info on an unlimited
amount of students. The system lets the user know which books are
available for issue at any point of time. This makes the issue / return
of books considerably faster and thus helps the library in better
management and reduces a lot of paper work as well as manpower.

DRAWBACKS OF THE EXISTING SYSTEM:


 Manual entry consumes more time.
 It is difficult to maintain a lot of record.
 Overall efficiency is less.
 Lot of paperwork.
 Non-secure.
 The manual system is too slow

3
 Searching is more time consuming

ADVANTAGES OF THE PROPOSED SYSTEM:


 Secure data
 Faster processing
 Better management
 Saves a lot of manpower
 Elimination of paperwork
 High reliability and security

4
WORKING DESCRIPTION

First a database is created namely “Library” and tables namely


“books”, “issue” and “submit”. Then the user is asked for the
password. After entering the password, the user is provided with 5
choices:
1. Add books
2. Issue books
3. Submit books
4. Delete books
5. Display books

Then the user has to enter a choice according to which the input has to
be given.
If the user enters an invalid choice, the execution of the program
stops.

If choice is 1, the user is asked to enter details such as bookname ,


bookcode , subject and totalbooks. These values are then inserted into
the table “books” and the message “data entered successfully” is
displayed on the screen.

If the choice is 2, the user is asked to enter details such as name,


regno , bookcode and issue_date These values are then inserted into
the table “issue” and the message “book issued to <name>” is
displayed on the screen.

If the choice is 3, the user is asked to enter details such as name,


regno , bookcode and submission_date. These values are then

5
inserted into the table “submit” and the message “book submitted by
<name> ” is displayed on the screen.
If the choice is 4, then the user has to enter the bookcode and the
book with the given bookcode will be deleted from the table and the
message “Book with bookcode <bookcode> successfully deleted” is
displayed on the screen.

If the choice is 5, then all the books along with their details present in
the “books” table are displayed.

6
FUNCTIONS AND MODULES

MODULES:

import mysql.connector

By importing this package, we are able to establish the connection


between MySQL and Python.

FUNCTIONS:

connect():
This function establishes connection between Python and MySQL

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.

7
The syntax is:
<cursor object>.execute(<sql query string>)

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

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():
It makes all the changes made by statements issued permanent.

8
DETAILED DESCRIPTION

This project has 3 mysql tables:


1) books
2) issue
3) submit

1. The table books contains the following columns:


i. bookname
ii. bookcode
iii. subject
iv. totalbooks

9
2. The table issue contains the following columns:
i. name
ii. regno
iii. bookcode
iv. issue_date

10
3. The table submit contains the following columns:
i. name
ii. regno
iii. bookcode
iv. submission_date

11
SOURCE CODE

FOR MySQL:

create database library;

use library;

create table books


(bookname varchar(100),
bookcode integer,
subject varchar(20),
totalbooks integer);

create table issue


(name varchar(100),
regno integer,
bookcode integer,
issue_date date);

create table submit


(name varchar(100),
regno integer,
bookcode integer,
submission_date date);

FOR PYTHON:

import mysql.connector as sqltor


12
mycon= sqltor.connect(host= 'localhost',user= 'root',password=
'1234',database= 'library')

if mycon.is_connected():
print("Successfully connected to mysql database")

def addbook():
bookname=input("Enter the name of the book:")
bookcode=int(input("Enter the code of the book:"))
subject=input("Enter the subject of the book:")
totalbooks=int(input("Enter the total number of books:"))

data=(bookname,bookcode,subject,totalbooks)
sqlinsert="insert into books values(%s,%s,%s,%s)"
mycursor=mycon.cursor()
mycursor.execute(sqlinsert,data)
mycon.commit()
print()
print("...........-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*...........")
print("data entered successfully")
main()

def issuebook():
iname=input("Enter the name of the student:")
regno=int(input("Enter the registration no:"))
bcode=int(input("Enter the code of the book:"))
issue=input("Enter the date of issuing the book:")

data=(iname,regno,bcode,issue)
i="insert into issue values(%s,%s,%s,%s)"
mycursor=mycon.cursor()
mycursor.execute(i,data)
mycon.commit()

13
print()
print("...........-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*...........")
print("book issued to:",iname)
print()
bookup(bcode,-1)

def submitbook():
iname=input("Enter the name of the student:")
regno=int(input("Enter the registration no:"))
bcode=int(input("Enter the code of the book:"))
subdate=input("Enter the date of submission of the book:")

data = (iname,regno,bcode,subdate)
i = "insert into submit values(%s,%s,%s,%s)"
mycursor = mycon.cursor()
mycursor.execute(i, data)
mycon.commit()

print("...........-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*...........")
print("book submitted by:", iname)
bookup(bcode,1)

def bookup(bcode,u):
i = "select totalbooks from books where bookcode=%s"
data=(bcode,)
mycursor = mycon.cursor()
mycursor.execute(i, data)
myresult=mycursor.fetchone()
t=myresult[0]+u
sqlinsert="update books set totalbooks=%s where
bookcode= %s "
d=(t,bcode)
mycursor.execute(sqlinsert,d)
mycon.commit()
main()
14
def deletebooks():
db=input("Enter the book code:")
i = "delete from books where bookcode=%s"
data=(db,)
mycursor = mycon.cursor()
mycursor.execute(i, data)
mycon.commit()
print("Book with bookcode",db,"succesfully deleted")
main()

def displaybooks():
i='select * from books'
mycursor = mycon.cursor()
mycursor.execute(i)
myresult=mycursor.fetchall()
for i in myresult:
print("book name:",i[0])
print("book code:", i[1])
print("subject of book:", i[2])
print("total books:", i[3])

print()

print("...........-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*...........")
main()

def main():
print("**********LIBRARY MANAGEMENT
SYSTEM**********")
print("""1.ADD books
2.ISSUE books
3.SUBMIT books
4.DELETE books
5.DISPLAY books""")

15
choice=input("Enter the task number:")

print("...........-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*...........")
if choice=='1':
addbook()
elif choice=='2':
issuebook()
elif choice=='3':
submitbook()
elif choice=='4':
deletebooks()
elif choice=='5':
displaybooks()
else:
print("#### WRONG CHOICE #### ")
main()

def passwd():
ps=input("Enter password:")
if ps=="LMS":
main()
else:
print("Wrong password")
passwd()
passwd()

16
OUTPUT

1. Add a book

MySQL Output:

17
2. Issue a book

MySQL Output:

18
3. Submit a book

MySQL Output:

19
4. Delete a book

MySQL Output:

20
5. Display books

21
BIBLIOGRAPHY

22
 https://www.slideshare.net/DarshitVaghasiya1/library-
management-python-mysql

 https://www.studocu.com/in/document/kendriya-vidyalaya-
hebbal/computer-science/pdf-for-cd-class-12-ak-this-code-for-
library-management-project-this-in-python-and-mysql/43783381

23

You might also like