https://github.com/harsh-arora-4114/e-commerce-data-analysis
Built and analyzed a relational database to derive insights on sales, customer behavior, and product performance. Used advanced SQL queries for data aggregation, trend analysis, and inventory monitoring. Strengthened skills in data visualization through queries and business reporting.
https://github.com/harsh-arora-4114/e-commerce-data-analysis
data-analysis-via-sql-queries relational-databases sql sql-data-visualization
Last synced: 5 months ago
JSON representation
Built and analyzed a relational database to derive insights on sales, customer behavior, and product performance. Used advanced SQL queries for data aggregation, trend analysis, and inventory monitoring. Strengthened skills in data visualization through queries and business reporting.
- Host: GitHub
- URL: https://github.com/harsh-arora-4114/e-commerce-data-analysis
- Owner: Harsh-Arora-4114
- License: mit
- Created: 2024-06-29T13:02:27.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2025-12-07T12:53:15.000Z (7 months ago)
- Last Synced: 2025-12-09T05:17:59.889Z (7 months ago)
- Topics: data-analysis-via-sql-queries, relational-databases, sql, sql-data-visualization
- Homepage:
- Size: 88.9 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# E-Commerce
## Overview
This SQL script sets up a relational database for an e-commerce platform. It includes tables for customers, suppliers, products, orders, and order details, along with queries to analyze sales, top-selling products, and inventory management.
## Database Schema
### Tables
1. **Customers** - Stores customer details.
2. **Suppliers** - Stores supplier details.
3. **Products** - Stores product information and references suppliers.
4. **Orders** - Stores customer orders and their statuses.
5. **OrderDetails** - Stores detailed order information, including quantity and price.
### Relationships
- **Products** references **Suppliers** (`SupplierID`).
- **Orders** references **Customers** (`CustomerID`).
- **OrderDetails** references **Orders** (`OrderID`) and **Products** (`ProductID`).
## Setup Instructions
1. **Create the Database and Tables**
```sql
CREATE DATABASE ecommerce;
USE ecommerce;
```
2. **Run the provided SQL script to create tables and insert sample data.**
## Queries Included
- **Total Sales per Customer**: Calculates total revenue per customer.
- **Top Selling Products**: Identifies the most sold products.
- **Sales Trend Over Time**: Analyzes daily revenue.
- **Average Order Value**: Computes the average value of orders.
- **Inventory Management**: Lists products with stock greater than 2.
## Example Usage
### Retrieving Total Sales per Customer
```sql
SELECT C.CustomerName, SUM(OD.Quantity * OD.Price) as TotalSales
FROM Customers C
JOIN Orders O ON C.CustomerID = O.CustomerID
JOIN OrderDetails OD ON O.OrderID = OD.OrderID
GROUP BY C.CustomerName;
```
### Checking Inventory Levels
```sql
SELECT ProductName, Stock
FROM Products
WHERE Stock > 2;
```
## Contributions
Feel free to fork this repository, submit issues, or make pull requests.
## License
This project is licensed under the MIT License.
## Author
Developed by Harsh Arora