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.
- Analyzed approximately 10,000 retail sales records.
- Performed business analysis using SQL and SQLite.
- Processed and analyzed data with Pandas.
- Created visualizations using Matplotlib.
- Exported analytical reports as CSV files.
- Organized SQL queries into reusable SQL scripts.
- 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.
- 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.
- Python
- SQLite
- SQL
- Pandas
- Matplotlib
- Jupyter Notebook
- Git
- GitHub
Dataset: Sample Superstore
The dataset contains retail sales transactions including:
- Orders
- Customers
- Products
- Categories
- Regions
- Sales
- Profit
- Discounts
- Quantity
sql-python-business-analytics/
│
├── data/
├── database/
├── images/
├── notebooks/
├── outputs/
├── sql/
│ ├── 01_database_setup.sql
│ └── 02_business_analysis.sql
├── README.md
├── requirements.txt
└── .gitignore
This project answers important business questions such as:
- Which category generates the highest sales?
- Which region performs the best?
- Which customer segment contributes the most revenue?
- Who are the top-performing customers?
- Which products generate losses?
- How do sales and profits change over time?
- Total Sales
- Total Profit
- Total Orders
- Average Order Value
- Profit Margin
- Sales by Segment
- Profit by Segment
- Profit Margin by Segment
- Sales by Category
- Profit by Category
- Average Sale
- High Sales Categories
- Sales by Region
- Regional Profitability
- Technology Sales by Region
- Loyal Customers
- Top Sales Customers
- Customer Profit Analysis
- Top Sales Products
- Product Profit Analysis
- Loss-Making Products
- Monthly Sales Trends
- Yearly Sales Trends
- 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.
- Several products and customers generated negative profits due to heavy discounting.
- Sales performance varied across regions, highlighting opportunities for targeted business strategies.
- 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.
- Monitor monthly sales trends to support inventory and sales planning.
- SELECT
- WHERE
- GROUP BY
- ORDER BY
- HAVING
- COUNT()
- SUM()
- AVG()
- ROUND()
- LIMIT
- SQLite Functions
- sqlite3
- Pandas
- DataFrames
- SQL Integration
- CSV Export
- Matplotlib Visualization
- KPI Reporting
- Customer Analysis
- Product Analysis
- Regional Analysis
- Trend Analysis
- Business Recommendations
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.
- Organize and publish a professional analytics project using Git and GitHub.
- Build an interactive dashboard using Power BI.
- Explore advanced SQL concepts such as Joins, CTEs, and Window Functions.
- Automate report generation.
- Extend the analysis with predictive analytics.
- Deploy the project as an interactive analytics application.
- Clone this repository.
git clone https://github.com/lena-basheer/sql-python-business-analytics.git- Navigate to the project folder.
cd sql-python-business-analytics-
Create and activate a virtual environment.
-
Install the required packages:
pip install -r requirements.txt- Launch Jupyter Notebook:
jupyter notebook- Open:
notebooks/analysis.ipynb
- Run all cells to reproduce the analysis and visualizations.
Lena B
Aspiring Data Analyst | SQL | Python | Excel | Power BI | Pandas | SQLite | Matplotlib



