← Back to Projects
Retail Sales Analysis (SQL)
SQL Server
EDA
Business Analysis
Problem Statement
Retail businesses generate large volumes of transactional data, but without structured analysis,
it becomes difficult to extract meaningful insights.
This project focuses on analyzing sales performance, customer behavior, and operational trends
using SQL to support data-driven decision making.
Dataset & Structure
The dataset consists of transactional retail data including customer demographics,
product categories, and sales values.
CREATE TABLE retail_sales (
transactions_id INT PRIMARY KEY,
sale_date DATE,
sale_time TIME,
customer_id INT,
gender VARCHAR(10),
age INT,
category VARCHAR(35),
quantity INT,
price_per_unit FLOAT,
cogs FLOAT,
total_sale FLOAT
);
Data Cleaning
Ensured data quality by identifying and removing records with missing values across key fields.
Removed 3 records with NULL values to maintain data consistency and accuracy.
Key Analysis Performed
Sales Performance Analysis
- Total transactions and revenue trends
- Category-wise sales performance
Customer Analysis
- Unique customer count
- Top 5 customers by revenue
- Customer demographics (age, gender)
Operational Insights
- High-value transactions (>1000 sales)
- Best-performing months using window functions
- Sales distribution across time of day (Morning/Afternoon/Evening)
SQL Techniques Used
- Aggregations (SUM, COUNT, AVG)
- Filtering & conditional logic (WHERE, CASE)
- Window functions (RANK)
- Subqueries and CTEs
- Date & time functions
Key Insights
Certain product categories consistently drive higher sales volume.
A small group of customers contributes disproportionately to total revenue.
Sales activity peaks during specific times of the day, indicating operational optimization opportunities.
Business Implications
The analysis provides a foundation for:
- Customer targeting and retention strategies
- Inventory and category optimization
- Time-based staffing and operational planning
Future Enhancements
- Build dashboards in Power BI
- Add indexing for query optimization
- Extend analysis to profitability using COGS
View Full SQL Project on GitHub