Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Repository files navigation

Business Performance Analysis Using MySQL

Project Overview

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.


Business Problem

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?

Objectives

  • 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.

Tools & Technologies

  • MySQL
  • SQL
  • VS Code
  • Python
  • CSV
  • Git
  • GitHub

Database

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.

SQL Skills Demonstrated

The project demonstrates both fundamental and advanced SQL skills.

Basic SQL

  • SELECT
  • WHERE
  • ORDER BY
  • GROUP BY
  • HAVING
  • Aggregate Functions
  • CASE Statements

Joins

  • INNER JOIN
  • LEFT JOIN

Intermediate SQL

  • Subqueries
  • Common Table Expressions (CTEs)
  • Conditional Aggregation
  • Date Functions
  • Data Validation

Advanced SQL

  • Window Functions
  • RANK()
  • DENSE_RANK()
  • ROW_NUMBER()
  • LAG()
  • Running Totals
  • Month-over-Month Analysis
  • Year-over-Year Analysis

Key KPIs

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 Formula

Revenue = Selling Price × Quantity × (1 − Discount / 100)

Profit Formula

Profit = Revenue − Product Cost

Profit Margin Formula

Profit Margin = (Profit / Revenue) × 100

Target Achievement Formula

Target Achievement % = (Actual Sales / Sales Target) × 100


Key Business Findings

The SQL analysis produced several important business findings.

Best Performing Store

Hyderabad Square generated ₹60,45,907.50 in revenue.

Best Performing Region

The West region generated ₹1,70,79,952.50 in revenue.

Most Profitable Department

The Electronics department generated ₹61,22,875 in profit.

Top Product

Laptop Air was the highest-revenue product.

  • Units Sold: 151
  • Revenue: ₹80,70,700

Top Employee

Arjun Patel, working at Mumbai Central, generated ₹27,90,285 in revenue.

Best Performing Month

June 2024 generated the highest monthly revenue of ₹33,85,685.

Lowest Performing Store

Bangalore Central, located in the South region, generated ₹40,35,230 in revenue.

Highest-Value Customer

Priya Sharma, a Silver membership customer, generated ₹10,15,370 in total spending.


Business Recommendations

Based on the analysis, the following recommendations can be made:

  1. 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.

  2. 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.

  3. 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.

  4. Maintain Laptop Air availability: Laptop Air generated the highest product-level revenue. Inventory and demand should be monitored closely to avoid stock shortages.

  5. 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.

  6. 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.

  7. 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.


Project Structure

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

About

SQL-based business performance analysis focused on KPIs, sales trends, profitability, customer performance, and actionable business insights.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages