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.
- 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
- π¬ MySQL Workbench
- π SQL
- π» VS Code
- π GitHub
- π Kaggle Dataset
Dataset: Retail Sales Dataset
Author: Mohammad Talib
Source: Kaggle
- Transaction ID
- Sale Date
- Customer Name
- City
- Product Category
- Product Name
- Quantity
- Unit Price
- Total Amount
CREATE DATABASE retail_sales_db;
USE retail_sales_db;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)
);The CSV dataset was imported into MySQL Workbench and loaded into the retail_sales table.
SELECT
MONTH(sale_date) AS month,
SUM(total_amount) AS revenue
FROM retail_sales
GROUP BY month
ORDER BY month;SELECT
product_category,
SUM(total_amount) AS revenue
FROM retail_sales
GROUP BY product_category
ORDER BY revenue DESC;SELECT
customer_name,
SUM(total_amount) AS spending
FROM retail_sales
GROUP BY customer_name
ORDER BY spending DESC
LIMIT 5;- Product categories contributed differently to overall revenue.
- Revenue analysis helps identify high-performing product groups.
- Revenue varied across different months.
- Monthly analysis helps understand sales patterns and seasonality.
- Top customers generated significantly higher spending compared to others.
- Identifying high-value customers supports targeted business strategies.
-
CREATE DATABASE
-
Data Import
-
CREATE TABLE
-
SELECT
-
WHERE
-
GROUP BY
-
ORDER BY
-
LIMIT
-
COUNT()
-
SUM()
-
Aggregate Functions
-
Business Analytics
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
git clone https://github.com/Unnati22p/Retail-Sales-SQL-Analysis.gitRun the SQL commands from:
SQL_Queries.sql
Import:
retail_sales_dataset.csv
into the retail_sales table.
Run the SQL queries to generate insights and results.
This project demonstrates practical SQL skills used in real-world data analysis, including database creation, data management, revenue analysis, customer analysis, and business reporting.
Unnati Patil
Aspiring Data Analyst | SQL | Python | Data Analytics






