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

Library_Management_SQL_Project

The document outlines a Library Management System project using SQL, featuring tables for books, members, and borrow logs. It includes an ER diagram, database schema, sample data, and queries for managing book availability and overdue returns. Future enhancements may involve stored procedures and a web interface for improved user interaction.

Uploaded by

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

Library_Management_SQL_Project

The document outlines a Library Management System project using SQL, featuring tables for books, members, and borrow logs. It includes an ER diagram, database schema, sample data, and queries for managing book availability and overdue returns. Future enhancements may involve stored procedures and a web interface for improved user interaction.

Uploaded by

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

Library Management System - SQL Mini Project

1. Project Overview

This project is a simple Library Management System designed using SQL. It includes tables to store

data about books, members, and borrow logs. The system supports common operations like issuing

books, returning them, and checking overdue returns.

2. ER Diagram (Text-based)

Entities:

- Book (BookID, Title, Author, Publisher, TotalCopies, AvailableCopies)

- Member (MemberID, Name, Email, Phone)

- Borrow_Log (LogID, BookID, MemberID, IssueDate, ReturnDate, DueDate)

Relationships:

- A member can borrow many books.

- A book can be borrowed multiple times.

- Borrow_Log connects members and books with issue/return data.

3. Database Schema (SQL)

CREATE TABLE Book (

BookID INT PRIMARY KEY,

Title VARCHAR(100),

Author VARCHAR(100),

Publisher VARCHAR(100),

TotalCopies INT,
AvailableCopies INT

);

CREATE TABLE Member (

MemberID INT PRIMARY KEY,

Name VARCHAR(100),

Email VARCHAR(100),

Phone VARCHAR(15)

);

CREATE TABLE Borrow_Log (

LogID INT PRIMARY KEY,

BookID INT,

MemberID INT,

IssueDate DATE,

ReturnDate DATE,

DueDate DATE,

FOREIGN KEY (BookID) REFERENCES Book(BookID),

FOREIGN KEY (MemberID) REFERENCES Member(MemberID)

);

4. Sample Data (INSERTs)

INSERT INTO Book VALUES (1, '1984', 'George Orwell', 'Penguin', 5, 3);

INSERT INTO Book VALUES (2, 'The Alchemist', 'Paulo Coelho', 'HarperCollins', 4, 2);

INSERT INTO Member VALUES (101, 'Alice Smith', '[email protected]', '1234567890');


INSERT INTO Member VALUES (102, 'Bob Johnson', '[email protected]', '0987654321');

INSERT INTO Borrow_Log VALUES (1, 1, 101, '2025-04-01', NULL, '2025-04-15');

INSERT INTO Borrow_Log VALUES (2, 2, 102, '2025-04-10', '2025-04-20', '2025-04-18');

5. Sample Queries

-- List all available books

SELECT * FROM Book WHERE AvailableCopies > 0;

-- Show currently borrowed books

SELECT b.Title, m.Name, l.IssueDate, l.DueDate

FROM Borrow_Log l

JOIN Book b ON l.BookID = b.BookID

JOIN Member m ON l.MemberID = m.MemberID

WHERE l.ReturnDate IS NULL;

-- List overdue books

SELECT m.Name, b.Title, l.DueDate

FROM Borrow_Log l

JOIN Book b ON l.BookID = b.BookID

JOIN Member m ON l.MemberID = m.MemberID

WHERE l.ReturnDate IS NULL AND l.DueDate < CURDATE();

6. Conclusion & Enhancements

This project demonstrates the core operations of a DBMS through a library context. Future

improvements could include stored procedures for issuing/returning books, fine calculation for late
returns, and a simple web interface for user interaction.

You might also like