This project analyses a real-world retail transaction dataset using MySQL to uncover customer behaviour, product performance, sales trends, and business insights.
The goal was not just querying data — but answering real business questions retailers care about:
- When do customers shop?
- Who are the most valuable customers?
- Which products drive revenue vs volume?
- How much revenue is lost due to returns?
- Can we identify VIP customers?
The dataset contains transactional retail data with the following attributes:
| Column | Description |
|---|---|
| invoiceno | Unique order identifier |
| date | Purchase date |
| time | Purchase time |
| stockcode | Product code |
| description | Product name |
| quantity | Units purchased (negative = return) |
| unitprice | Price per unit |
| custid | Customer ID |
| country | Customer location |
Before analysis, the dataset required cleaning:
- Split
InvoiceDate→Date&Time - Converted European date format → MySQL format
- Handled NULL & blank values during import
- Fixed datatype issues (
InvoiceNostored as VARCHAR due to cancellations) - Managed negative quantities (returns)
- Sales peak during specific hours of the day
- Weekdays generate more revenue than weekends
- Evening shopping contributes high order counts
👉 Helps staffing & promotion scheduling
- Identified repeat purchase cycle using purchase gap analysis
- Segmented customers into High / Medium / Low value
- Found VIP customers (Top 5%) using percentile ranking
- Detected one-time buyers and churned customers
👉 Helps retention & loyalty programs
- Top products by revenue differ from top products by quantity
- Some items sell frequently but generate low revenue
- Some premium items sell rarely but drive profit
👉 Helps inventory & pricing strategy
- Returns detected using negative quantity & cancellation invoices
- Certain products have disproportionately high return rates
- Calculated revenue lost due to returns
👉 Helps quality control decisions
- Revenue contribution varies significantly by country
- Different regions prefer different product types
👉 Helps market expansion planning
- RFM Analysis (Recency, Frequency, Monetary)
- Customer Segmentation
- Repeat Purchase Cycle Detection
- Cohort Identification
- Pareto (80/20) Customer Rule
- Order Pattern Analysis
- Time-based Sales Analysis
- MySQL 8 → Data analysis & querying
- Pandas → Pre-processing & formatting
- SQL Window Functions → Advanced analytics
This project simulates how a retail company would use transaction data to:
- Optimise inventory
- Improve marketing targeting
- Identify high-value customers
- Reduce product returns
- Predict repeat purchases
IKEA-Retail-SQL-Analysis/
│── ikea.zip/
│── │── ikea/
│── │── ikea_updated/
│── Cleaning.ipynb
│── ikea.sql
│── README.md
- Handling messy real-world datasets
- Writing analytical SQL beyond basic SELECT queries
- Using window functions for behavioural analysis
- Translating data into business decisions
Abhishek Singh Aspiring Data Analyst | SQL • Python • Power BI