Cs Ritvik Project Final
Cs Ritvik Project Final
CLASS: XII-A
ROLL NUMBER:
1
CERTIFICATE
Date:
2
ACKNOWLEDGEMENT
I would also like to thank my parents, friends and all the members who
contributed to this project was vital for the success of the project.
3
INDEX
S.NO TOPIC PAGE.NO
1 INTRODUCTION 5
5 DATABASE DESIGN 9
6 IMPLEMENTATION 10
8 OUTPUT 15-20
9 CONCLUSION 21
10 BIBLIOGRAPHY 22
4
LIBRARY MANAGEMENT SYSTEM
INTRODUCTION
WHY PYTHON?
Simplicity
Flexibility
Extensive Libraries
5
1. Ease of Development:
Using Python, you can easily execute SQL queries and manage large datasets
without complex configuration.
3. Cross-Platform Support:
Scalability: The system can easily be scaled up as the library grows. New
features like an online catalog, member notifications, and book
reservations can be integrated seamlessly with Python.
6
WHY MYSQL?
MySQL is a great choice for managing the data in a Library Management System
for several reasons:
In a library system, you need to store and manage large amounts of data, such as:
Organizing data into tables with rows and columns, making it easy to
retrieve and update.
Maintaining Relationships between different data entities (e.g., books,
members, transactions) using foreign keys, ensuring data consistency.
SQL is the language used to interact with MySQL databases. It allows you to
perform operations such as:
Libraries require that data, such as book availability and member transactions, be
handled reliably and accurately. MySQL provides:
Data Integrity: Ensures that the data stored is accurate and consistent. For
example, a book cannot be borrowed if it is already issued.
7
4. Scalability
As the library grows, so will the data. MySQL can handle large amounts of data
efficiently, making it easy to scale the system when new records (e.g., books,
members, transactions) are added. Whether the system is used by a small library
or a larger institution, MySQL can accommodate growing databases.
5. Multi-User Support
6. Security Features
MySQL can easily integrate with Python using libraries like mysql-connector-
python This allows:
Easy interaction between Python and the database: Python can send
SQL queries to MySQL to retrieve or modify data.
Automation: Python scripts can automate tasks such as generating reports,
updating book records, or notifying members about due dates.
8
Advantages of Using MySQL in the Library Management System
1. Efficient Data Storage: MySQL can handle structured data, such as books
and member details, efficiently.
2. Fast Data Retrieval: MySQL allows for quick searches and retrievals of
data, such as finding available books or a member's borrowing history.
3. Transaction Management: The system ensures that actions such as
borrowing and returning books are recorded accurately, preventing issues
like overbooking.
4. Data Relationships: MySQL allows you to define relationships between
tables (books, members, transactions), making it easy to link data and
maintain consistency.
DATABASE DESIGN
The system uses a relational database to store information about books,
members, and transactions. The database consists of threemain tables:
1. Books Table: Stores information about each book, including its ID,title,
author, and availability status.
9
IMPLEMENTATION
Back end: Python
Database: MySQL
Connector: MySQL Connector for Python
Borrowing a Book
When a member borrows a book, the system checks if the book is
available, updates the availability status, and records the transaction
in the database.
Returning a Book
When a book is returned, the system updates the book's availability
status and records the return date in the transaction table
FUTURE ENHANCEMENTS
10
SOURCE CODE
a) For Python
import mysql.connector
from datetime import datetime
cursor = conn.cursor()
def view_books():
cursor.execute( "SELECT * FROM books")
books = cursor.fetchall()
for book in books:
print(book)
def add_member(name):
cursor.execute("INSERT INTO members (name) VALUES (%s)",
(name,))
print("Member added successfully.")
conn.commit()
12
elif choice == '3':
name = input("Enter member name: ")
add_member(name)
break
else:
print("Invalid choice. Please try again.")
except:
print('Only Integer')
main()
13
b) For SQL
USE library_db;
14
OUTPUT
---------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------
15
2)Viewing Available Books
---------------------------------------------------------------------------------------------
16
4)Borrowing a Book
Library Management System
1.Add Book
2. View Books
3. Add Member
4. Borrow Book
5. Return Book
6. Exit
Enter your choice: 4
Enter book ID: 1
Enter member ID: 1
Book borrowed successfully.
------------------------------------------------------------------------------------------
Checking availability:
17
If the book is not available:
---------------------------------------------------------------------------------------------
18
5)Returning a Book
Library Management System
1. Add Book
2. View Books
3. Add Member
4. Borrow Book
5. Return Book
6. Exit
Enter your choice: 5
Enter book ID: 1
Enter member ID: 1
Book returned successfully.
Checking availability:
1
6)Exiting
20
CONCLUSION
2
BIBLIOGRAPHY
www.geeksforgeeks.org
www.stackoverflow.com
https://www.britannica.com
22