Laksh New
Laksh New
LIBRARY MANAGEMENT
Submitted to
Central Board of Secondary Education
Submitted By:
Lakshy Jha
XII SCIENCE
1
CERTIFICATE
Principal
Internal External
Examiner Examiner
2
ACKNOWLEDGEMENT
3
Introduction:
4
Objective:
5
Limitation of the Project:
6
be lost, which can be addressed with backup and
recovery features.
7
Hardware Requirements:
1. Computer/Laptop:
A basic computer or laptop with the required
operating system (Windows/Linux/Mac) for running
the Python script and MySQL server.
2. Storage Device:
Sufficient storage to store the MySQL database and
Python scripts.
3. Internet Connection:
Needed for installing packages like MySQL
Connector and Python libraries (if not already
installed).
8
Software Requirements:
1. Operating System:
Windows/Linux/Mac OS.
2. Python:
Python 3.x, which is the programming language used
for implementing the logic behind the Library
Management System.
3. MySQL:
MySQL 5.x or above is used to manage the database
and store information regarding the books and issued
records.
4. MySQL Connector for Python:
The mysql.connector Python module is required to
connect Python with the MySQL database. It can be
installed using the following command:
bash Copy code pip install
MySQL-connector-python
5. Text Editor or IDE:
Any code editor or Integrated Development
Environment (IDE) like Visual Studio Code,
PyCharm, or Sublime Text for writing and editing the
Python code.
9
Source Code
import mysql.connector
= mysql.connector.connect(
host="localhost",
user="root",
password="vaidehi",
database="library1"
= mydb.cursor()
add_book():
sql = "INSERT INTO books (book_name, author, genre, status) VALUES (%s, %s, %s, %s)"
mycursor.execute(sql, values)
mydb.commit()
10
print("Book added successfully.")
view_books():
books = mycursor.fetchall()
if len(books) == 0:
books:
print(f"ID: {book[0]}, Name: {book[1]}, Author: {book[2]}, Genre: {book[3]}, Status: {book[4]}")
delete_book():
def library_menu():
while True:
11
print("5. Issued Books")
print("7. Exit")
if choice == 1:
add_book() elif
choice == 2:
view_books() elif
choice == 3:
delete_book()
elif choice==4:
r=mycursor.fetchall()
for i in r:
print(i)
return date")
mycursor.execute("insert into
issue(issue,book,idate,rdate)values('{}','{}','{}','{}')".format(iname,bname,idate,rdate))
mydb.commit()
elif choice==5:
12
for i in r:
print(i)
elif choice==6:
break else:
13
SQL TABLE-
14
OUTPUT
1.ADD A BOOK
15
3.DELETE A BOOK
4.Issue A Book
16
5.Issued Books
6.Return Book
7.Exit
Exit successfully
17
Bibliography
1. Python Documentation o
Author(s): Python Software
Foundation o Publisher:
Python.org o Website:
https://docs.python.org/
o Content Referenced: Python programming
language documentation, libraries, and modules
used in the project.
2. MySQL Documentation o
Author(s): Oracle Corporation o
Publisher: MySQL
o Website: https://dev.mysql.com/doc/
o Content Referenced: Information on MySQL
database management system, SQL queries, and
MySQL Connector for Python.
18
3."Python for Data Analysis" o
Author(s): Wes McKinney o
Publisher: O'Reilly Media o Year:
2018
19
6."Database Management
Systems"
o Author(s): Raghu Ramakrishnan, Johannes
Gehrke o Publisher:
McGraw-Hill o Year: 2003
20