This project analyzes retail business performance using MySQL and SQL to transform transactional data into meaningful business insights and actionable recommendations.
The analysis covers business transactions from 2024 to 2025 across stores, regions, employees, products, and customers.
The project focuses on understanding revenue, profitability, store performance, regional performance, employee productivity, product performance, customer value, monthly sales trends, and sales target achievement.
The complete analytical workflow includes data preparation, database creation, data validation, SQL analysis, advanced SQL techniques, business insights, and recommendations.
The management team wants to understand the company's sales and business performance and identify areas that require improvement.
The analysis aims to answer important business questions such as:
- Which stores generate the highest revenue?
- Which regions perform best?
- Which stores are underperforming?
- Which products generate the most revenue?
- Which departments are most profitable?
- Which employees generate the highest sales?
- Which customers contribute the most revenue?
- Which months generate the highest revenue?
- How does business performance change between 2024 and 2025?
- How well are stores achieving their sales targets?
- Where should management focus improvement efforts?
- Analyze overall business performance.
- Calculate key business KPIs.
- Analyze store-level revenue and profitability.
- Compare regional performance.
- Identify high-performing and underperforming stores.
- Analyze product sales, revenue, and profitability.
- Evaluate employee performance.
- Identify high-value customers.
- Analyze monthly and yearly sales trends.
- Compare actual sales with sales targets.
- Apply advanced SQL techniques to business problems.
- Generate actionable business recommendations.
- MySQL
- SQL
- VS Code
- Python
- CSV
- Git
- GitHub
The project uses a relational MySQL database named business_performance.
The database contains six main tables:
| Table | Description | Records |
|---|---|---|
stores |
Store information and locations | 10 |
employees |
Employee information and store assignments | 30 |
products |
Product, category, cost, and selling price information | 52 |
customers |
Customer information and membership details | 200 |
sales |
Transaction-level sales data | 2,000 |
targets |
Monthly sales targets for each store | 240 |
Analysis Period: 2024–2025
The main relationships in the database are:
- Stores are connected to employees.
- Stores are connected to monthly sales targets.
- Sales are connected to stores.
- Sales are connected to employees.
- Sales are connected to products.
- Sales are connected to customers.
The project demonstrates both fundamental and advanced SQL skills.
- SELECT
- WHERE
- ORDER BY
- GROUP BY
- HAVING
- Aggregate Functions
- CASE Statements
- INNER JOIN
- LEFT JOIN
- Subqueries
- Common Table Expressions (CTEs)
- Conditional Aggregation
- Date Functions
- Data Validation
- Window Functions
- RANK()
- DENSE_RANK()
- ROW_NUMBER()
- LAG()
- Running Totals
- Month-over-Month Analysis
- Year-over-Year Analysis
The project calculates the following business KPIs:
- Total Revenue
- Total Cost
- Total Profit
- Total Transactions
- Total Units Sold
- Average Transaction Value
- Profit Margin
- Annual Revenue
- Revenue Growth
- Monthly Revenue
- Target Achievement
Revenue = Selling Price × Quantity × (1 − Discount / 100)
Profit = Revenue − Product Cost
Profit Margin = (Profit / Revenue) × 100
Target Achievement % = (Actual Sales / Sales Target) × 100
The SQL analysis produced several important business findings.
Hyderabad Square generated ₹60,45,907.50 in revenue.
The West region generated ₹1,70,79,952.50 in revenue.
The Electronics department generated ₹61,22,875 in profit.
Laptop Air was the highest-revenue product.
- Units Sold: 151
- Revenue: ₹80,70,700
Arjun Patel, working at Mumbai Central, generated ₹27,90,285 in revenue.
June 2024 generated the highest monthly revenue of ₹33,85,685.
Bangalore Central, located in the South region, generated ₹40,35,230 in revenue.
Priya Sharma, a Silver membership customer, generated ₹10,15,370 in total spending.
Based on the analysis, the following recommendations can be made:
-
Improve underperforming stores: Bangalore Central recorded the lowest store-level revenue. Management should investigate its product mix, employee productivity, customer demand, transaction volume, and target achievement.
-
Learn from high-performing regions: The West region generated the highest revenue. Successful practices from this region can be studied and potentially applied to weaker regions.
-
Focus on profitable products: Electronics was the most profitable department. The company should maintain strong inventory availability for profitable products and evaluate opportunities to expand successful categories.
-
Maintain Laptop Air availability: Laptop Air generated the highest product-level revenue. Inventory and demand should be monitored closely to avoid stock shortages.
-
Leverage top employee performance: Arjun Patel was the highest-revenue employee. His sales practices can be studied to identify strategies that could improve overall employee performance.
-
Investigate high-performing periods: June 2024 recorded the highest monthly revenue. Factors such as promotions, seasonal demand, product availability, and customer behavior should be investigated.
-
Strengthen customer retention: High-value customers such as Priya Sharma can be targeted with personalized offers, loyalty rewards, and product recommendations to improve customer retention and lifetime value.
Business-Performance-SQL/
│
├── README.md
│
├── Dataset/
│ ├── generate_data.py
│ ├── customers.csv
│ ├── employees.csv
│ ├── products.csv
│ ├── sales.csv
│ ├── stores.csv
│ └── targets.csv
│
├── screenshots/
│ ├── database_tables.png
│ ├── business_kpis.png
│ ├── store_performance.png
│ ├── monthly_growth.png
│ └── business_insights.png
│
├── 01_create_database.sql
├── 02_create_tables.sql
├── 03_import_data.sql
├── 04_data_exploration.sql
├── 05_business_kpis.sql
├── 06_business_analysis.sql
├── 07_advanced_sql.sql
└── 08_business_insights.sql