Project Title: Retail Sales Analysis
Database: retail_db
Tools Used: MySQL Server, MySQL Workbench, SQL
This project focuses on analyzing retail sales data using SQL to uncover meaningful business insights. It demonstrates essential SQL skills used by data analysts, including database creation, data cleaning, exploratory data analysis (EDA), aggregate functions, filtering, grouping, subqueries, and window functions.
The goal is to transform raw retail sales data into useful insights that can support business decision-making.
- Database Setup: Create a database and table to store retail sales data.
- Data Cleaning: Identify and handle missing or NULL values.
- Exploratory Data Analysis (EDA): Explore the dataset to understand sales patterns and customer demographics.
- Business Analysis: Answer business questions using SQL queries.
- Insight Generation: Identify sales trends, customer purchasing behavior, and product category performance.
Database Name: retail_db
Table Name: retail_sales
The retail_sales table contains the following columns:
| Column Name | Description |
|---|---|
transactions_id |
Unique transaction identifier |
sale_date |
Date of the transaction |
sale_time |
Time of the transaction |
customer_id |
Unique customer identifier |
gender |
Customer gender |
age |
Customer age |
category |
Product category |
quantity |
Quantity of products sold |
price_per_unit |
Price per unit of the product |
cogs |
Cost of goods sold |
total_sale |
Total sales amount for the transaction |
- Database and table creation
- Data cleaning and NULL value handling
SELECT,WHERE, andORDER BY- Aggregate functions:
SUM(),AVG(),COUNT() GROUP BYandHAVING- Date functions:
YEAR(),MONTH(),DATE_FORMAT() - Subqueries and Common Table Expressions (CTEs)
- Window functions:
RANK()andPARTITION BY - Business problem-solving using SQL
This project explores retail sales through business-focused SQL queries, including:
- Retrieve all sales transactions.
- Identify customers who made purchases.
- Analyze sales by product category.
- Find transactions in a specific category with a minimum quantity sold.
- Calculate total sales and the number of orders.
- Identify the highest-selling product categories.
- Calculate the average sale for each month and find the best-performing month in each year.
- Analyze customer demographics and purchasing patterns.
- Identify top customers based on spending.
- Explore sales trends across different periods.
Through this project, I practiced writing SQL queries to clean, organize, and analyze retail sales data. I strengthened my understanding of aggregate functions, date-based analysis, subqueries, and window functions while learning how to approach business questions using data.
Snehal Bahalkar
Aspiring Data Analyst | SQL | MySQL | Power BI | Excel | Python
🔗 GitHub: Snehal2004
⭐ If you find this project useful, feel free to explore the repository and share your feedback.