Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 

Repository files navigation

📊 E-Commerce Sales Analysis Using SQL

PostgreSQL SQL Data Analysis Window Functions CTE


📌 Project Overview

This project demonstrates an end-to-end SQL-based analysis of an e-commerce sales dataset using PostgreSQL.

The objective is to transform raw transactional data into meaningful business insights by applying data cleaning, feature engineering, KPI analysis, customer segmentation, product analysis, and advanced SQL techniques.


🎯 Business Objectives

  • Analyze overall sales performance
  • Identify high-performing products and categories
  • Evaluate customer purchasing behavior
  • Measure regional sales performance
  • Analyze discount effectiveness
  • Discover profit improvement opportunities
  • Generate actionable business recommendations

🛠 Tools & Technologies

  • PostgreSQL
  • SQL
  • Window Functions
  • Common Table Expressions (CTEs)
  • Aggregate Functions
  • CASE WHEN
  • Date Functions

📂 Dataset

The dataset contains e-commerce transaction records including:

  • Orders
  • Customers
  • Products
  • Categories
  • Regions
  • Payment Methods
  • Discounts
  • Sales
  • Profit
  • Order Dates

🧹 Data Cleaning

  • Removed duplicate records
  • Checked NULL values
  • Validated data types
  • Standardized text values
  • Created enriched helper columns
  • Generated Quarter column
  • Created Profit Margin
  • Created Discount Bucket
  • Created Order Size Category
  • Created High Value Order Flag

📊 SQL Concepts Used

  • SELECT
  • WHERE
  • GROUP BY
  • HAVING
  • ORDER BY
  • CASE WHEN
  • Aggregate Functions
  • JOINS
  • CTEs
  • Window Functions
  • ROW_NUMBER()
  • RANK()
  • DENSE_RANK()
  • LAG()
  • Running Total
  • Market Share Analysis
  • RFM Analysis
  • Pareto Analysis

📈 Analysis Performed

  • KPI Analysis
  • Category Analysis
  • Product Analysis
  • Customer Analysis
  • Geographic Analysis
  • Payment Method Analysis
  • Discount Analysis
  • Quarterly Analysis
  • Time Series Analysis
  • Customer Segmentation
  • Profitability Analysis
  • Statistical Analysis

💡 Key Business Insights

  • Goa generated the highest sales among all cities.
  • Electronics recorded the highest average selling price.
  • Home Decor captured the highest market share (10.72%).
  • North region generated the highest sales.
  • Q2 generated the highest revenue.
  • A 5% discount produced the highest sales.
  • Net Banking was the preferred payment method.
  • Sales increased by 324% after 2023 before declining by 26.99% after 2024.

📌 Business Recommendations

  • Increase inventory before Q2.
  • Expand the Home Decor category.
  • Focus marketing on the North region.
  • Maintain a 5% discount strategy.
  • Promote high-margin products.
  • Improve profitability of low-margin products.
  • Reward high-value customers.
  • Investigate the post-2024 sales decline.

📷 Project Preview

Add screenshots of important SQL query outputs here.

Example:

images/
│── dashboard.png
│── customer_analysis.png
│── product_analysis.png
│── quarterly_sales.png

📁 Repository Structure

E-Commerce-Sales-Analysis-SQL
│
├── dataset.csv
├── data_cleaning.sql
├── analysis.sql
├── README.md
└── images/

👨‍💻 Author

Jatin Patidar

  • LinkedIn: (Add your LinkedIn URL)
  • GitHub: (Add your GitHub URL)

⭐ If you found this project helpful, consider giving it a Star!

About

An end-to-end SQL data analytics project using PostgreSQL, featuring data cleaning, feature engineering, KPI analysis, customer segmentation, window functions, CTEs, time series analysis, and actionable business insights for an e-commerce sales dataset.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors