0% found this document useful (0 votes)
9 views24 pages

libray management pawan final

Uploaded by

nagarkrishh54
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)
9 views24 pages

libray management pawan final

Uploaded by

nagarkrishh54
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/ 24

2 YYY

2
CERTIFICATE
This is to certify that PAWAN KUMAR of class XII-B has
successfully completed the INFORMATICS PRACTICES
project on the topic of LIBRARY MANAGEMENT under the
guidance of MRS. SANGEETA MAHOPATRA mam
during the academic year 2024-2025.

INTERNAL EXAMINER PRINCIPAL

DATE EXTERNAL EXAMINER

2 YYY
2

1
2 YYY
Acknowledgement
I would like to express my special thanks of gratitude
to my teacher MRS SANGEETA MAHOPATRA mam as
well as our principal MRS SANGEETA SHARMA mam
who gave me the golden opportunity to do this project
of informatics practices which also helped me in doing
a lot of research and I came to know new things about
it. without there help, guidance and support it would
have been impossible to complete this project.

Secondly, I would also like to thank my parents and


friends who helped me a lot in finishing this project
with limited time. I am making this project not only for
marks but also to increase my knowledge.

Once again thanks to all who helped me in doing this


project.

2 YYY
2

2
2 YYY
PROJECT ON
LIBRARY MANAGEMENT
2024-25

2 YYY
2

3
2 YYY
INDEX
SNO. PARTICULARS PAEG NO.

1 PROJECT ANALYSIS 5

2 FUNCTIONS & MODULES 6-8

3 DETAILED DESCRIPTION 9

4 SOURCE CODE 10-19

5 OUTPUTS & TABELS 20-22

6 BIBLIOGRAPHY 23

7 REMARS 24
2

2 YYY
4
2 YYY
PROJECT ANAYLSIS
Our application program is especially
Designed for the sardar Patel vidya Niketan named
“READING COMMUNITY”

They lend books to readers who have subscribed with


the library.

We have tried to maximize the efficiency and strived


for students, teachers and users 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 & MYSQL as our platform to


carry out this task.
2

2 YYY
5
2 YYY
FUNCTIONS AND MODULES

MODULES :

#import.mysql.connector:

By importing this package, we are able to establish the


connection between SQL & PYTHON.

# from datetime import date


The datetime module in python helps you work with dates and times
like getting the current date, formatting, or calculating differences.

2
2

YYY 6
2 YYY
FUNCTIONS :

connect () :
this function establishes connection between python &
mysql .

cursor():
it is a special control structure that facilitates the row
by row processing of recordes in the result set.
<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.
2

2 YYY
7
2 YYY
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 the tuple containing the records.

commit():
this function provides change in the database
physically.
2

2 YYY
8
2 YYY
DETAILED DESCRIPTION
# our project has three MySQL tables. These are: -
1. Books management
2. Members Management
3. Issue/Return

1) The table book management contain the following columns :


1. Add Book Record
2. Display Book Records
3. Search Book Record
4. Delete Book Record
5. Update Book Record
6. Exit to Main menu

2) The table members management contain the following columns:


1. Add Member Record
2. Display Member Records
3. Search Member Record
4. Delete Member Record

3) The table Issue/Return contain the following columns :


1. Issue Book
2. Display Issued Books
3. Return Book

2 YYY
2

9
2 YYY
SOURCE CODE
import mysql.connector

from datetime import date

# Database connection

try:

mydb = mysql.connector.connect(

host="localhost",

user="root",

password="PAWAN@123kumar",

database="spvn_library"

if mydb.is_connected():

print("Connected to MySQL database!")

else:

print("Failed to connect to MySQL database!")

except mysql.connector.Error as err:

print(f"Error: {err}")

exit(1)

# Initialize cursor after confirming connection

mycursor = mydb.cursor()

# Create database and tables if they don't exist

10
mycursor.execute("CREATE DATABASE IF NOT EXISTS spvn_library")

mycursor.execute("""

CREATE TABLE IF NOT EXISTS book_record (

bno VARCHAR(8) PRIMARY KEY,

bname VARCHAR(20),

author VARCHAR(20),

publisher VARCHAR(50),

price INT(10),

qty INT(50),

d_of_purchased DATE

)""")

mycursor.execute("""

CREATE TABLE IF NOT EXISTS member (

mno VARCHAR(5) PRIMARY KEY,

mname CHAR(20),

mobile INT(10),

addr VARCHAR(50),

d_of_mship DATE

)""")

mycursor.execute("""

CREATE TABLE IF NOT EXISTS issue (

issue_no VARCHAR(5),

bno VARCHAR(5),

mno VARCHAR(5),

d_of_issue DATE,

d_of_return DATE

)""")

# Function to add a new book to the library

def addbook():

L = []

11
bno = input("Enter book code: ")

L.append(bno)

bname = input("Enter book name: ")

L.append(bname)

author = input("Enter author name: ")

L.append(author)

pub = input("Enter publisher name: ")

L.append(pub)

price = int(input("Enter price of the book: "))

L.append(price)

qty = int(input("Enter the quantity of the book: "))

L.append(qty)

d_of_pur = input("Enter date of purchase (YYYY-MM-DD): ")

L.append(d_of_pur)

ab = tuple(L) # Convert list to tuple for SQL

sql = "INSERT INTO book_record (bno, bname, author, publisher, price, qty, d_of_purchased)
VALUES (%s, %s, %s, %s, %s, %s, %s)"

mycursor.execute(sql, ab)

mydb.commit()

print("Book added successfully!")

# Function to display all books

def display():

mycursor.execute("SELECT * FROM book_record")

rows = mycursor.fetchall()

for x in rows:

print(x)

# Function to remove a book by its ISBN

def removebook():

12
bno = input("Enter book ISBN code to delete from the SPVN Library: ")

mycursor.execute("DELETE FROM book_record WHERE bno=%s", (bno,))

mydb.commit()

print("Book deleted successfully!")

# Function to search a book by its code

def SearchBookRec():

bno = input("Enter book code to search from the SPVN Library: ")

query = "SELECT * FROM book_record WHERE bno=%s"

mycursor.execute(query, (bno,))

data = mycursor.fetchall()

if data:

print(data)

return True

else:

print("Record not found, try again!")

return False

# Function to update book information

def UpdateBook():

bno = input("Enter book code of the book to be updated: ")

query = "SELECT * FROM book_record WHERE bno=%s"

mycursor.execute(query, (bno,))

data = mycursor.fetchall()

if data:

print("Current book data:", data)

print("Enter new data:")

bname = input("Enter new book name: ")

author = input("Enter new author name: ")

13
# Corrected column name typo

qry = "UPDATE book_record SET bname=%s, author=%s WHERE bno=%s"

mycursor.execute(qry, (bname, author, bno))

mydb.commit()

print(f"Book {bno} updated successfully!")

else:

print("Record not found, try again!")

# Function to add a new member to the library

def insertMember():

mno = input("Enter Member Code: ")

mname = input("Enter Member Name: ")

mobile = int(input("Enter Mobile Number: "))

addr = input("Enter Address: ")

d_of_mship = input("Enter Date of Membership (YYYY-MM-DD): ")

qry = "INSERT INTO member (mno, mname, mobile, addr, d_of_mship) VALUES (%s, %s, %s, %s,
%s)"

mycursor.execute(qry, (mno, mname, mobile, addr, d_of_mship))

mydb.commit()

print("Member added successfully!")

# Function to display all members

def displaymem():

mycursor.execute("SELECT * FROM member")

rows = mycursor.fetchall()

for x in rows:

print(x)

# Function to delete a member

14
def deleteMember():

mno = input("Enter Member Code to delete from SPVN Library: ")

qry = "DELETE FROM member WHERE mno=%s"

mycursor.execute(qry, (mno,))

mydb.commit()

print("Member deleted successfully!")

# Function to search a member by name

def SearchMember():

mname = input("Enter Member name to search from the SPVN Library: ")

query = "SELECT * FROM member WHERE mname=%s"

mycursor.execute(query, (mname,))

data = mycursor.fetchall()

if data:

print(data)

return True

else:

print("Record not found, try again!")

return False

# Function to issue a book

def issuebook():

issue_no = input("Enter issue number: ")

mno = input("Enter member code: ")

bno = input("Enter book code to issue: ")

d_of_issue = input("Enter date of issue (YYYY-MM-DD): ")

d_of_return = input("Enter expected date of return (YYYY-MM-DD): ")

qry = "INSERT INTO issue (issue_no, mno, bno, d_of_issue, d_of_return) VALUES (%s, %s, %s, %s,
%s)"

mycursor.execute(qry, (issue_no, mno, bno, d_of_issue, d_of_return))

15
mydb.commit()

print("Book issued successfully!")

# Function to display all issued books

def ShowIssuedBooks():

mycursor.execute("SELECT * FROM issue")

rows = mycursor.fetchall()

for x in rows:

print(x)

# Function to return a book

def returnbook():

bno = input("Enter book code to return: ")

mno = input("Enter member code of the returning member: ")

retDate = date.today()

qry = "UPDATE issue SET d_of_return=%s WHERE bno=%s AND mno=%s"

mycursor.execute(qry, (retDate, bno, mno))

mydb.commit()

print(f"Book {bno} returned successfully!")

# Main menu function

def spvn_library1():

while True:

print("\t\t\tSPVN Library Management\n")

print("1. Book Management")

print("2. Members Management")

print("3. Issue/Return Book")

print("4. Exit")

userinput = int(input("Enter choice: "))

16
if userinput == 1:

while True:

print("\nSPVN Book Record Management\n")

print("1. Add Book Record")

print("2. Display Book Records")

print("3. Search Book Record")

print("4. Delete Book Record")

print("5. Update Book Record")

print("6. Exit to Main menu")

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

if choice == 1:

addbook()

elif choice == 2:

display()

elif choice == 3:

SearchBookRec()

elif choice == 4:

removebook()

elif choice == 5:

UpdateBook()

elif choice == 6:

break

else:

print("Wrong input, try again.")

elif userinput == 2:

while True:

print("\nSPVN Member Record Management\n")

print("1. Add Member Record")

print("2. Display Member Records")

17
print("3. Search Member Record")

print("4. Delete Member Record")

print("5. Exit to Main menu")

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

if choice == 1:

insertMember()

elif choice == 2:

displaymem()

elif choice == 3:

SearchMember()

elif choice == 4:

deleteMember()

elif choice == 5:

break

else:

print("Wrong input, try again.")

elif userinput == 3:

while True:

print("\nSPVN Issue/Return Book Management\n")

print("1. Issue Book")

print("2. Display Issued Books")

print("3. Return Book")

print("4. Exit to Main menu")

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

if choice == 1:

issuebook()

elif choice == 2:

ShowIssuedBooks()

18
elif choice == 3:

returnbook()

elif choice == 4:

break

else:

print("Wrong input, try again.")

elif userinput == 4:

mycursor.close()

mydb.close()

print("Exiting the SPVN Library Management System. Goodbye!")

break

else:

print("Wrong input, please try again.")

# Run the program

spvn_library1()

2 YYY
2

19
2 YYY

Q
OUTPUT SCREENS

m
20
21
22
2 YYY
2
2 YYY
BIBLIOGRAPHY
TO develop this project many references were
used :

✓ Computer science with python by Sumita


Arora.
✓ Informatics Practices class XII- by Preeti
Arora.
✓ Together with computer science with python
by Rachna Sagar.
✓ https://www.google.com
✓ http://enwikipedia.org

2 YYY
2

23
2 YYY
REMARKS

2 YYY
2

24

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy