0% found this document useful (0 votes)
27 views9 pages

Database Project

Uploaded by

mhmad Fawaz
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views9 pages

Database Project

Uploaded by

mhmad Fawaz
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 9

Lebanese International University

Mohamad Al Jawad Fawaz:12410256

Online Bookstore Management System


Submitted to the school of Arts & Sciences of The Lebanese International University

CSCI335

Supervised By: Dr. Mohamad Dbouk

Fall:2024-2025
Introduction The Online Bookstore Management System is an innovative
solution designed to address the challenges of managing a modern
bookstore. This project combines database management principles with
practical functionality to create a robust and efficient system for both store
owners and customers. With the rise of digital platforms, bookstores face
increased pressure to provide seamless services, including inventory
management, customer relationship tracking, and real-time sales analysis.
Our project demonstrates the implementation of these features within a
relational database system, ensuring scalability, accuracy, and usability.

The system is designed to allow customers to explore a wide range of books,


place orders, and make secure payments. At the same time, it equips store
managers with tools to track inventory, supplier interactions, and sales
performance. By integrating data normalization, ER modeling, and advanced
SQL operations, this project exemplifies how databases can transform
traditional business operations into efficient, data-driven enterprises.
Chapter 1: Collecting Requirements and Analysis

Overview

The Online Bookstore Management System is designed to manage and


streamline the operations of a bookstore. This system will assist in handling
book inventory, customer details, and sales records while providing a
platform for customers to search and purchase books.
Requirements

Functional Requirements

 Manage book inventory (add, update, delete books).


 Allow customers to search for books by title, author, or genre.
 Process orders and maintain sales records.
 Track customer information.
 Generate sales and inventory reports.
Non-Functional Requirements

 Ensure data integrity and security.


 Optimize query performance for large datasets.
 Provide a user-friendly interface for database interactions.
Use Case Scenarios

1. A customer searches for books by a specific author and places an


order.
2. The bookstore manager updates the inventory when new stock
arrives.
3. A report is generated to show the top-selling books of the month.
Analysis

Entities Identified

 Books, Customers, Orders, Order Details, Suppliers, Payments.


Relationships Identified

 A customer can place multiple orders.


 Each order contains one or more books.
 Books are supplied by multiple suppliers.

Chapter 2: Database Design

Data Modeling

Entity-Relationship (ER) Diagram

Below is a simple representation of the ER diagram using a text-based style:

+------------+ +-------------+ +-----------+


+-------------+
| Customers | | Orders | | Books |
| Suppliers |
+------------+ +-------------+ +-----------+
+-------------+
| CustomerID |<----+ | OrderID |<----+ | BookID |<----+
| SupplierID |
| Name | | | CustomerID | | | Title | |
| Name |
| Email | | | OrderDate | +----| Author | |
| ContactInfo|
| Phone | | | TotalAmount | | Genre | |
| Address | | +-------------+ | Price | |
+------------+ | | StockQty | |
| +-----------+ |
| |
+-------------------------------+--------------+
|
|
+-------------+
| OrderDetails|
+-------------+
| OrderDetailID|
| OrderID |
| BookID |
| Quantity |
| Subtotal |
+-------------+

+------------+ +-------------+
| Payments | | OrderDetails|
+------------+ +-------------+
| PaymentID | |
| OrderID |
| PaymentDate|
| Amount |
| Method |
+------------+
Relational Model Mapping
Table Name Attributes Relationships

BookID (PK), Title, Author, Genre, Price,


Books SupplierID → Suppliers.SupplierID
StockQuantity, SupplierID (FK)

CustomerID (PK), Name, Email, Phone,


Customers None
Address

OrderID (PK), CustomerID (FK), CustomerID →


Orders
OrderDate, TotalAmount Customers.CustomerID

OrderDetailID (PK), OrderID (FK), OrderID → Orders.OrderID, BookID


OrderDetails
BookID (FK), Quantity, Subtotal → Books.BookID

Suppliers SupplierID (PK), Name, ContactInfo None

PaymentID (PK), OrderID (FK),


Payments OrderID → Orders.OrderID
PaymentDate, Amount, PaymentMethod

Normalization

1. 1NF: All attributes are atomic.


2. 2NF: All attributes are fully functionally dependent on the primary key.
3. 3NF: Transitive dependencies have been removed.
Chapter 3: SQL Scripts

Table Creation
CREATE TABLE Books (
BookID INT PRIMARY KEY,
Title VARCHAR(100),
Author VARCHAR(100),
Genre VARCHAR(50),
Price DECIMAL(10, 2),
StockQuantity INT,
SupplierID INT,
FOREIGN KEY (SupplierID) REFERENCES Suppliers(SupplierID)
);

CREATE TABLE Customers (


CustomerID INT PRIMARY KEY,
Name VARCHAR(100),
Email VARCHAR(100),
Phone VARCHAR(15),
Address VARCHAR(255)
);

CREATE TABLE Orders (


OrderID INT PRIMARY KEY,
CustomerID INT,
OrderDate DATE,
TotalAmount DECIMAL(10, 2),
FOREIGN KEY (CustomerID) REFERENCES Customers(CustomerID)
);

CREATE TABLE OrderDetails (


OrderDetailID INT PRIMARY KEY,
OrderID INT,
BookID INT,
Quantity INT,
Subtotal DECIMAL(10, 2),
FOREIGN KEY (OrderID) REFERENCES Orders(OrderID),
FOREIGN KEY (BookID) REFERENCES Books(BookID)
);

CREATE TABLE Suppliers (


SupplierID INT PRIMARY KEY,
Name VARCHAR(100),
ContactInfo VARCHAR(255)
);

CREATE TABLE Payments (


PaymentID INT PRIMARY KEY,
OrderID INT,
PaymentDate DATE,
Amount DECIMAL(10, 2),
PaymentMethod VARCHAR(50),
FOREIGN KEY (OrderID) REFERENCES Orders(OrderID)
);

Data Insertion
INSERT INTO Books (BookID, Title, Author, Genre, Price, StockQuantity,
SupplierID)
VALUES (1, 'The Great Gatsby', 'F. Scott Fitzgerald', 'Fiction', 10.99,
50, 1);

INSERT INTO Customers (CustomerID, Name, Email, Phone, Address)


VALUES (1, 'John Doe', '[email protected]', '123-456-7890', '123 Main
St');

INSERT INTO Suppliers (SupplierID, Name, ContactInfo)


VALUES (1, 'ABC Distributors', '[email protected]');

INSERT INTO Orders (OrderID, CustomerID, OrderDate, TotalAmount)


VALUES (1, 1, '2024-12-26', 21.98);

INSERT INTO OrderDetails (OrderDetailID, OrderID, BookID, Quantity,


Subtotal)
VALUES (1, 1, 1, 2, 21.98);

INSERT INTO Payments (PaymentID, OrderID, PaymentDate, Amount,


PaymentMethod)
VALUES (1, 1, '2024-12-26', 21.98, 'Credit Card');
Chapter 4: Data Manipulation

SQL Queries

Retrieve all books in stock


SELECT * FROM Books WHERE StockQuantity > 0;

Find orders placed by a specific customer


SELECT Orders.OrderID, Orders.OrderDate, Orders.TotalAmount
FROM Orders
JOIN Customers ON Orders.CustomerID = Customers.CustomerID
WHERE Customers.Name = 'John Doe';

Generate a monthly sales report


SELECT MONTH(OrderDate) AS Month, SUM(TotalAmount) AS TotalSales
FROM Orders
GROUP BY MONTH(OrderDate);

Update stock after a purchase


UPDATE Books
SET StockQuantity = StockQuantity - 2
WHERE BookID = 1;

Delete a customer record


DELETE FROM Customers WHERE CustomerID = 1;
\

Conclusion The Online Bookstore Management System project encapsulates the


essential principles of database design, normalization, and implementation. It showcases
the practical application of SQL in creating, managing, and querying relational databases.
The ER diagram and relational schema ensure a well-structured database, facilitating
efficient data storage and retrieval.

Through this project, we demonstrated how a bookstore can effectively manage its
inventory, track customer interactions, and analyze sales performance. By focusing on
both functional and non-functional requirements, the system is built to be scalable,
secure, and user-friendly. Future enhancements, such as integrating advanced reporting
tools or expanding to e-commerce platforms, could further augment its capabilities. This
project not only meets its objectives but also lays the groundwork for future growth and
innovation in bookstore management systems.

You might also like