Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SQL + Python Business Analytics

Project Overview

This project demonstrates an end-to-end business analytics workflow using SQL, SQLite, Python, Pandas, and Matplotlib. The goal is to analyze retail sales data, answer business questions using SQL, and create visualizations that support data-driven decision-making.

The project follows a real-world analytics workflow:

  • Import retail sales data into a SQLite database.
  • Analyze the data using SQL queries.
  • Load SQL query results into Python with Pandas.
  • Create visualizations using Matplotlib.
  • Generate business insights and recommendations.

Objectives

  • Practice SQL for business analysis.
  • Learn how SQL and Python work together.
  • Perform exploratory data analysis (EDA).
  • Build a GitHub-ready portfolio project.
  • Present business insights through data visualization.

Features

  • Import and analyze sales data using SQLite.
  • Execute SQL queries for business reporting.
  • Integrate SQL results into Python.
  • Analyze data using Pandas.
  • Create professional visualizations using Matplotlib.
  • Export analysis results as CSV files.
  • Generate business recommendations from data.

Technologies Used

  • Python
  • SQLite
  • SQL
  • Pandas
  • Matplotlib
  • Jupyter Notebook

Dataset

Dataset: Sample Superstore

The dataset contains retail sales transactions including:

  • Orders
  • Customers
  • Products
  • Categories
  • Regions
  • Sales
  • Profit
  • Discounts

Project Structure

sql-python-business-analytics/
│
├── data/
├── database/
├── notebooks/
├── outputs/
├── images/
├── src/
├── README.md
├── requirements.txt
└── .gitignore

Analysis Performed

KPI Analysis

  • Total Sales
  • Total Profit
  • Total Orders
  • Average Order Value
  • Profit Margin

Category Analysis

  • Sales by Category
  • Profit by Category
  • Profit Margin

Regional Analysis

  • Sales by Region
  • Regional Profitability

Customer Analysis

  • Top Sales Customers
  • Top Profit Customers
  • Loss-Making Customers

Product Analysis

  • Top Sales Products
  • Top Profit Products
  • Loss-Making Products

Time Analysis

  • Monthly Sales Trends
  • Yearly Sales Trends

Visualizations

Sales by Category

Category Sales

Sales by Region

Region Sales

Sales by Customer Segment

Segment Sales

Top 10 Customers by Sales

Top Customers


Key Business Insights

  • Technology generated the highest sales and overall profit.
  • Furniture recorded high sales but the lowest profit margin.
  • The West region achieved the highest sales performance.
  • The Consumer segment generated the highest overall revenue.
  • Some high-sales customers generated losses, indicating potential pricing or discount issues.

Business Recommendations

  • Continue investing in high-performing Technology products.
  • Improve Furniture profitability by reviewing pricing and discount strategies.
  • Increase marketing efforts in lower-performing regions.
  • Review pricing and discount policies for loss-making customers and products.

Skills Demonstrated

SQL

  • SELECT
  • WHERE
  • GROUP BY
  • ORDER BY
  • COUNT()
  • SUM()
  • AVG()
  • ROUND()
  • LIMIT

Python

  • sqlite3
  • Pandas
  • DataFrames
  • SQL Integration
  • CSV Export
  • Matplotlib Visualization

Business Analysis

  • KPI Reporting
  • Customer Analysis
  • Product Analysis
  • Regional Analysis
  • Trend Analysis
  • Business Recommendations

Learning Outcomes

Through this project, I learned how to:

  • Store data in a SQLite database.
  • Write SQL queries for business analysis.
  • Connect Python with SQLite.
  • Load SQL query results into Pandas.
  • Create business visualizations using Matplotlib.
  • Communicate insights through data analysis and recommendations.

Future Improvements

  • Build an interactive dashboard using Power BI.
  • Explore advanced SQL concepts such as joins and window functions.
  • Automate report generation.
  • Extend the analysis with predictive analytics.

How to Run

  1. Clone this repository.

  2. Create and activate a virtual environment.

  3. Install the required packages:

pip install -r requirements.txt
  1. Launch Jupyter Notebook:
jupyter notebook
  1. Open:
notebooks/analysis.ipynb
  1. Run all cells to reproduce the analysis and visualizations.

Author

Lena B

Aspiring Data Analyst | SQL | Python | Excel | Power BI

About

End-to-end SQL and Python Business Analytics project using SQLite, Pandas, and Matplotlib.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages