Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

11 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Retail Sales SQL Analysis

πŸ“Š Retail Sales SQL Analysis

A complete SQL project analyzing retail sales data using MySQL Workbench. This project demonstrates database creation, data importing, SQL querying, and business insight generation from retail transaction data.


🎯 Project Objectives

  • Create and manage a MySQL database
  • Import retail sales data from CSV
  • Perform revenue analysis
  • Identify top customers
  • Analyze monthly sales trends
  • Generate business insights using SQL

πŸ› οΈ Tools Used

  • 🐬 MySQL Workbench
  • πŸ“ SQL
  • πŸ’» VS Code
  • 🌐 GitHub
  • πŸ“Š Kaggle Dataset

πŸ“‚ Dataset Information

Dataset: Retail Sales Dataset

Author: Mohammad Talib

Source: Kaggle

Dataset Features

  • Transaction ID
  • Sale Date
  • Customer Name
  • City
  • Product Category
  • Product Name
  • Quantity
  • Unit Price
  • Total Amount

πŸ—„οΈ Database Creation

Create Database

CREATE DATABASE retail_sales_db;
USE retail_sales_db;

πŸ“Έ Database Created

Database Created


🧱 Table Structure

Create Table

CREATE TABLE retail_sales (
    transaction_id INT PRIMARY KEY,
    sale_date DATE,
    customer_name VARCHAR(100),
    city VARCHAR(50),
    product_category VARCHAR(50),
    product_name VARCHAR(100),
    quantity INT,
    unit_price DECIMAL(10,2),
    total_amount DECIMAL(10,2)
);

πŸ“Έ Table Structure

Table Structure


πŸ“₯ Data Import

The CSV dataset was imported into MySQL Workbench and loaded into the retail_sales table.

πŸ“Έ Imported Data

Data Imported


πŸ” SQL Analysis Queries

1️⃣ Monthly Revenue Trend

SELECT
    MONTH(sale_date) AS month,
    SUM(total_amount) AS revenue
FROM retail_sales
GROUP BY month
ORDER BY month;

πŸ“Έ Output

Monthly Revenue


2️⃣ Revenue by Product Category

SELECT
    product_category,
    SUM(total_amount) AS revenue
FROM retail_sales
GROUP BY product_category
ORDER BY revenue DESC;

πŸ“Έ Output

Revenue by Category


3️⃣ Top 5 Customers by Spending

SELECT
    customer_name,
    SUM(total_amount) AS spending
FROM retail_sales
GROUP BY customer_name
ORDER BY spending DESC
LIMIT 5;

πŸ“Έ Output

Top Customers


πŸ“ˆ Key Insights

πŸ’° Revenue Analysis

  • Product categories contributed differently to overall revenue.
  • Revenue analysis helps identify high-performing product groups.

πŸ“… Monthly Trends

  • Revenue varied across different months.
  • Monthly analysis helps understand sales patterns and seasonality.

πŸ‘₯ Customer Analysis

  • Top customers generated significantly higher spending compared to others.
  • Identifying high-value customers supports targeted business strategies.

πŸ’‘ SQL Concepts Used

  • CREATE DATABASE

  • Data Import

  • CREATE TABLE

  • SELECT

  • WHERE

  • GROUP BY

  • ORDER BY

  • LIMIT

  • COUNT()

  • SUM()

  • Aggregate Functions

  • Business Analytics


πŸ“ Project Structure

Retail-Sales-SQL-Analysis/
β”‚
β”œβ”€β”€ retail_sales_dataset.csv
β”œβ”€β”€ SQL_Queries.sql
β”œβ”€β”€ README.md
β”‚
└── screenshots/
    β”œβ”€β”€ database_created.png
    β”œβ”€β”€ table_structure.png
    β”œβ”€β”€ data_imported.png
    β”œβ”€β”€ monthly_revenue.png
    β”œβ”€β”€ revenue_by_category.png
    └── top_customers.png

πŸš€ How to Run

1. Clone the Repository

git clone https://github.com/Unnati22p/Retail-Sales-SQL-Analysis.git

2. Open MySQL Workbench

3. Create Database and Table

Run the SQL commands from:

SQL_Queries.sql

4. Import Dataset

Import:

retail_sales_dataset.csv

into the retail_sales table.

5. Execute Queries

Run the SQL queries to generate insights and results.


⭐ Project Outcome

This project demonstrates practical SQL skills used in real-world data analysis, including database creation, data management, revenue analysis, customer analysis, and business reporting.


πŸ‘¨β€πŸ’» Author

Unnati Patil

Aspiring Data Analyst | SQL | Python | Data Analytics


⭐ If you found this project useful, feel free to star the repository!

About

Retail Sales SQL Analysis project using MySQL Workbench. Includes database creation, data import, revenue analysis, customer insights, and sales trend analysis using SQL queries.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors