Skip to content

JoudN2001/Database-Management-Project

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

📚 Book Sales Database Management System: From SQL to Big Data

🌟 Project Overview

Welcome to the Book Sales Database Management System. This project is a comprehensive data engineering journey that explores the evolution of database design. It starts with a traditional Relational Database (SQL) architecture based on strict Entity-Driven principles, and scales up to a Polyglot Persistence NoSQL architecture (Redis, Cassandra, Neo4j) designed for Big Data, ultimately integrating with the Hadoop Ecosystem (HDFS, MapReduce, YARN).

The overarching goal of this project is to demonstrate how to architect data solutions based on the application's read/write patterns (Query-Driven Design) rather than just the real-world entities.


🏗️ Phase 1 & 2: The Relational Era (SQL & Entity-Driven Design)

In the initial phases, the system was designed using classical Relational Database Management Systems (RDBMS). The focus was on data integrity, ACID compliance, and eliminating redundancy.

  • Entity-Relationship Modeling: Defined real-world entities like Customer, Cashier, Book, and Bill.
  • Normalization: Progressed the schema through 1NF, 2NF, and 3NF to prevent update anomalies.
  • SQL Operations: Implemented advanced queries, views, triggers, and stored procedures to handle complex business logic (e.g., updating stock after a sale).

3NF Schema
Figure 1: The Normalized Relational Schema (3NF)


🚀 Phase 3: The Paradigm Shift to NoSQL (Query-Driven Design)

As data volume grows to millions of transactions, horizontal scalability becomes crucial. In this phase, we abandoned the Entity-Driven approach in favor of a Query-Driven Design. We utilized three distinct NoSQL architectures, choosing the right tool for the right job (Polyglot Persistence).

1. Key-Value Model (Redis)

Goal: Lightning-fast $O(1)$ retrieval of complete documents (e.g., rendering a full invoice on a UI screen). We embedded the normalized tables into denormalized JSON strings. A single query to Bill:1001 fetches the customer info, cashier info, and all purchased books instantly.

Key-Value Model

2. Wide-Column Model (Cassandra / HBase)

Goal: Massive write performance and efficient analytical range queries without using expensive JOIN or global GROUP BY operations. We designed tables around the exact questions the application asks. For instance, using Partition Keys (K) to group invoices by month, and Clustering Keys (C) to sort them by date automatically on the disk.

Wide-Column Model

3. Graph Model (Neo4j)

Goal: Deep relationship traversal and pattern discovery (e.g., recommendation engines). We eliminated bridging tables (like Sale_Details) and foreign keys. Instead, we used physical Edges (Relationships) to connect Nodes, storing transactional properties like Quantity and TotalAmount directly on the [:CONTAINS] relationship.

Graph Model


🐘 Big Data Infrastructure: The Hadoop Ecosystem

To handle petabyte-scale data that traditional databases cannot process, the architecture relies on the Apache Hadoop ecosystem:

  • HDFS (Hadoop Distributed File System): Stores massive denormalized sales logs by splitting them into 128 MB blocks and replicating them across multiple DataNodes to ensure High Availability and Fault Tolerance (Partition Tolerance in CAP Theorem).
  • MapReduce: A distributed processing engine used to run heavy analytical jobs directly where the data lives. For example, aggregating millions of sales records to generate a "Sales Summary" by reducing key-value pairs (<BookISBN, TotalRevenue>).
  • YARN (Yet Another Resource Negotiator): Acts as the operating system for the cluster, with the ResourceManager dynamically allocating CPU and RAM (Containers) to ApplicationMasters executing the MapReduce jobs.

HDFS Architecture


📂 Repository Structure

├── src/                          # Source code for NoSQL queries
│   ├── cassandra_queries.cql     # Cassandra table schemas and CQL queries
│   ├── neo4j_queries.cypher      # Graph node creation and Cypher traversals
│   └── redis_commands.txt        # Key-Value injection commands
├── diagrams/                     # Architectural diagrams and models
│   ├── 1NF.png, 2NF.png, 3NF.png
│   ├── Key-Value Model.png
│   ├── Wide-Column Model.png
│   ├── Graph Model.png
│   └── HDFS Arch.jpg
└── docs/                         # Detailed academic and technical reports
    ├── Phase01.pdf
    ├── Phase02.pdf
    ├── Phase03.pdf
    └── Project - Database Management System.pdf

About

Database Management University Project

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors