0% found this document useful (0 votes)
12 views

Library_Management_System_SQL_Project_Document

The Library Management System is a SQL-based project designed to efficiently manage library operations, including tracking books, authors, borrowers, and transactions. It supports CRUD operations, automates overdue fine calculations, and generates reports for library administrators. The system is suitable for small to medium-sized libraries and includes a structured database schema with essential functionalities and future enhancement plans.

Uploaded by

Santram
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views

Library_Management_System_SQL_Project_Document

The Library Management System is a SQL-based project designed to efficiently manage library operations, including tracking books, authors, borrowers, and transactions. It supports CRUD operations, automates overdue fine calculations, and generates reports for library administrators. The system is suitable for small to medium-sized libraries and includes a structured database schema with essential functionalities and future enhancement plans.

Uploaded by

Santram
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

Library Management System - SQL

Project Document
Introduction
The Library Management System is a database project designed to manage the operations of
a library efficiently. It enables librarians to store, retrieve, and manage information about
books, authors, borrowers, and transactions. This system also tracks book loans, returns,
and overdue fines while generating useful reports for library administrators. This project is
built using SQL and focuses on relational database concepts, normalization, and query
optimization.

Objectives
To design a relational database for managing library resources.
To enable CRUD (Create, Read, Update, Delete) operations for books, borrowers, and
transactions.
To automate the tracking of book availability and overdue fines.
To generate reports such as the most borrowed books or overdue loans.

Scope
This system is designed for small to medium-sized libraries. It can be used to:
- Maintain a catalog of books and authors.
- Track borrowing and returning of books.
- Calculate overdue fines for late returns.
- Generate reports to help in decision-making.

Database Design
Schema Overview

The database consists of five main tables:


1. Books: Stores information about books in the library.
2. Authors: Stores details about book authors.
3. Borrowers: Contains information about library members.
4. Transactions: Tracks book loans and returns.
5. Fines: Records overdue fines for borrowers.
Entity Relationship Diagram (ERD)
The ERD shows the relationships between the tables:
- A book can have one author (one-to-many relationship).
- A borrower can borrow multiple books (one-to-many relationship).
- A transaction links a borrower with a specific book loan or return.

Database Schema
1. Books Table
Stores information about library books.

CREATE TABLE Books (


BookID INT PRIMARY KEY AUTO_INCREMENT,
Title VARCHAR(255) NOT NULL,
AuthorID INT,
Genre VARCHAR(100),
PublicationYear INT,
IsAvailable BOOLEAN DEFAULT TRUE,
FOREIGN KEY (AuthorID) REFERENCES Authors(AuthorID)
);

2. Authors Table
Stores details about authors.

CREATE TABLE Authors (


AuthorID INT PRIMARY KEY AUTO_INCREMENT,
Name VARCHAR(255) NOT NULL,
Nationality VARCHAR(100)
);

3. Borrowers Table
Stores information about library members.

CREATE TABLE Borrowers (


BorrowerID INT PRIMARY KEY AUTO_INCREMENT,
Name VARCHAR(255) NOT NULL,
ContactInfo VARCHAR(255)
);

4. Transactions Table
Tracks book loans and returns.

CREATE TABLE Transactions (


TransactionID INT PRIMARY KEY AUTO_INCREMENT,
BookID INT,
BorrowerID INT,
LoanDate DATE,
DueDate DATE,
ReturnDate DATE,
FOREIGN KEY (BookID) REFERENCES Books(BookID),
FOREIGN KEY (BorrowerID) REFERENCES Borrowers(BorrowerID)
);

5. Fines Table
Records overdue fines for borrowers.

CREATE TABLE Fines (


FineID INT PRIMARY KEY AUTO_INCREMENT,
BorrowerID INT,
Amount DECIMAL(10, 2),
Paid BOOLEAN DEFAULT FALSE,
FOREIGN KEY (BorrowerID) REFERENCES Borrowers(BorrowerID)
);

Functionalities
Basic Features
1. Add new books and authors to the catalog.
2. Register new borrowers in the system.
3. Record book loans and mark returned books as available.
4. Track overdue books and calculate fines dynamically.

Advanced Features
1. Generate reports:
- List of overdue books with borrower details.
- Most borrowed books in a specific time period.
2. Search functionality:
- Search for books by title, author, or genre.

Sample Queries
1. Add a New Book

INSERT INTO Books (Title, AuthorID, Genre, PublicationYear)


VALUES ('To Kill a Mockingbird', 1, 'Fiction', 1960);

2. Register a New Borrower

INSERT INTO Borrowers (Name, ContactInfo)


VALUES ('Alice Johnson', '[email protected]');

3. Record a Book Loan

INSERT INTO Transactions (BookID, BorrowerID, LoanDate, DueDate)


VALUES (1, 1, CURDATE(), DATE_ADD(CURDATE(), INTERVAL 14 DAY));

UPDATE Books SET IsAvailable = FALSE WHERE BookID = 1;

4. Mark a Book as Returned

UPDATE Transactions SET ReturnDate = CURDATE() WHERE TransactionID = 1;

UPDATE Books SET IsAvailable = TRUE WHERE BookID = 1;

5. Calculate Overdue Fines

SELECT
BorrowerID,
DATEDIFF(CURDATE(), DueDate) * 10 AS FineAmount
FROM Transactions
WHERE ReturnDate IS NULL AND DueDate < CURDATE();
6. Find Most Borrowed Books

SELECT
b.Title, COUNT(t.TransactionID) AS BorrowCount
FROM Books b
JOIN Transactions t ON b.BookID = t.BookID
GROUP BY b.Title
ORDER BY BorrowCount DESC;

Tools Used
Database Management System: MySQL or PostgreSQL.
SQL Client: MySQL Workbench or pgAdmin.
Optional: Python or PHP for building a front-end interface.

Testing Plan
Test CRUD operations:
- Add new records to all tables.
- Retrieve data using SELECT queries with filters.
- Update records like marking books as returned.
- Delete records like removing inactive borrowers.
Test advanced features:
- Generate reports on overdue books or most borrowed items.
- Verify fine calculations for overdue loans.
Validate data integrity:
- Ensure foreign key constraints are enforced correctly.

Future Enhancements
Add user roles:
- Librarian role with full access to all features.
- Member role with limited access to search and borrowing history.
Integrate front-end UI:
- Build a web-based or desktop application to interact with the database.
Implement notifications:
- Send email reminders for due dates or overdue fines.
Expand reporting capabilities:
- Include visualizations like charts for borrowing trends.
Conclusion
The Library Management System is an efficient solution for managing library operations
such as cataloging books, tracking loans/returns, and handling fines. This project
demonstrates core SQL skills such as schema design, querying, and optimization while
offering room for expansion into more advanced features like automation and analytics.

You might also like