Skip to content

SoumyasreeMitra/retail-sql-analytics

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Retail Business Intelligence & SQL Analytics Engine

📌 Project Overview

This project builds a normalized retail database using MySQL and performs advanced SQL analytics on 10,000+ e-commerce transactions to generate business KPIs and strategic insights.

The flat dataset was transformed into a relational schema to simulate enterprise-grade data modeling.


🗄️ Database Design

The original flat dataset was normalized into four relational tables:

  • customers
  • products
  • orders
  • order_items

Foreign key relationships were implemented to ensure referential integrity.

🗺️ ER Diagram

ER Diagram


📊 Analytics Performed

  • Total revenue calculation
  • Monthly revenue trend analysis
  • Month-over-Month (MoM) growth using LAG window function
  • Country revenue ranking using RANK()
  • Customer segment contribution %
  • Top 5 products by revenue
  • Customer lifetime value (CLV)
  • Category-wise revenue contribution

🧠 Advanced SQL Concepts Used

  • INNER JOIN
  • GROUP BY & Aggregations
  • Common Table Expressions (CTE)
  • Window Functions (LAG, RANK)
  • Revenue contribution percentage calculations
  • Date formatting & time-series grouping

📸 Sample Query Outputs

💰 Total Revenue

Total Revenue

📈 Monthly Revenue

Monthly Revenue Monthly Revenue

📊 Monthly Growth Analysis

Monthly Growth

🌍 Country Revenue Ranking

Country Ranking Country Ranking

👥 Segment Contribution

Segment Contribution Segment Contribution

📦 Top Products

Top Products Top Products

📈 Key Business Insights

💰 Overall Revenue Performance

  • Total Revenue: ~$1.63M
  • Strong MoM volatility observed, including a -44.5% drop in Feb 2022 and +51.3% rebound in Mar 2022.
  • Indicates seasonal demand behavior.

🌍 Geographic Performance

  • United States leads revenue generation (~$431K).
  • India is second (~$280K).
  • Revenue concentration suggests potential expansion opportunities.

👥 Customer Segment Analysis

  • Low-Value segment contributes 65.6% of revenue.
  • High-Value customers contribute only 8.8%.
  • Upselling and retention strategies may improve profitability.

📦 Product Analysis

  • Electronics category dominates top revenue positions.
  • Category concentration suggests dependency on electronics products.

🛠️ Tech Stack

  • MySQL 8
  • MySQL Workbench
  • Python (Pandas)
  • CSV-based data pipeline

📂 Project Structure

retail-bi-sql-engine/ │ ├── data/ ├── sql/ ├── scripts/ ├── outputs/ ├── README.md └── .gitignore


🎯 Business Value

This project demonstrates end-to-end data pipeline capability:

  • Data normalization
  • Relational modeling
  • Advanced SQL analytics
  • KPI engineering
  • Strategic business insight generation

About

Retail SQL analytics engine using MySQL (CTE, LAG, RANK) to generate revenue KPIs, segment insights, and business intelligence from 10K+ transactions.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages