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.
- 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
- PostgreSQL
- SQL
- Window Functions
- Common Table Expressions (CTEs)
- Aggregate Functions
- CASE WHEN
- Date Functions
The dataset contains e-commerce transaction records including:
- Orders
- Customers
- Products
- Categories
- Regions
- Payment Methods
- Discounts
- Sales
- Profit
- Order Dates
- 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
- 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
- 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
- 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.
- 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.
Add screenshots of important SQL query outputs here.
Example:
images/
│── dashboard.png
│── customer_analysis.png
│── product_analysis.png
│── quarterly_sales.png
E-Commerce-Sales-Analysis-SQL
│
├── dataset.csv
├── data_cleaning.sql
├── analysis.sql
├── README.md
└── images/
Jatin Patidar
- LinkedIn: (Add your LinkedIn URL)
- GitHub: (Add your GitHub URL)