Retail sales database built in PostgreSQL — 500 customers, 3000 orders, 9 SQL business queries with window functions and CTEs. Interactive dashboard built with Python and Plotly.
# Retail Sales Analysis — Eswatini & Region (2021–2023)
### PostgreSQL · Python · Business Intelligence Dashboard
---
## Overview
This project simulates a retail business database for a shop operating across Eswatini, South Africa, and Mozambique. Using PostgreSQL as the database engine and Python for analysis and visualisation, the project answers 9 real business questions that a retail manager would ask — from overall revenue performance to identifying the single most valuable customer for a loyalty award.
The central goal: **demonstrate end-to-end SQL and business intelligence skills — from database design and data loading through to querying, analysis, and interactive dashboarding.**
---
## Key Business Findings
- **Electronics is the top revenue category** at SZL 755,909 — driven by high-value items like Power Banks and Extension Cords
- **Clothing has the best profit margin at 41%** — highest of all 8 categories
- **Power Bank 10000mAh is the single best-selling product** at SZL 297,427 in revenue
- **VIP customers (151 out of 491) generate 53% of total revenue** — the business is heavily dependent on its top tier
- **Cape Town leads all regions** in both revenue and VIP customer count — cross-border sales are significant
- **Lubombo VIP customers spend the most on average** (SZL 8,099 per customer) despite having fewer VIPs
- **Loyalty Award Winner: Nompumelelo Mkhonta** from Hhohho, Eswatini — 9 orders, SZL 13,225 total spent since June 2022
---
## Project Structure
```
retail-sales-analysis-eswatini/
│
├── retail-sales-analysis-eswatini.py # Main analysis script
├── README.md # Project documentation
├── requirements.txt # Python dependencies
│
└── visuals/
└── sales_dashboard.html # Interactive tabbed dashboard
```
---
## Database Schema
The project creates a normalised relational database with 6 tables:
```
regions
└── customers (each customer belongs to a region)
└── orders (eac …