Skip to content

Latest commit

 

History

6 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

Retail Sales Performance Analysis

Emmanuella Alao

Data Analyst | Business Intelligence Analyst | AI Solutions Developer


Overview

A SQL-driven analysis of retail transaction data, digging into what actually generates revenue, who the highest-value customers are, and how performance differs across branches. No dashboard here, just queries doing the heavy lifting: joins, aggregates, and CASE logic turning raw transaction rows into answers a business can act on.


Business Problem

Retail businesses generate transaction data constantly, but raw rows in a sales_transactions table don't tell you which products are carrying the business, which customers are worth retaining, or which branches need attention. This project uses SQL directly against the data to answer those questions.


Tools Used

  • MySQL
  • SQL

Dataset

Retail Sales Dataset — transactional data spanning three related tables: sales_transactions, customers, and products.


What I Did

  • Queried transactional sales data directly in MySQL
  • Joined sales_transactions with customers and products to combine sales, customer, and product-level detail
  • Used aggregate functions (SUM), GROUP BY, and ORDER BY ... LIMIT to rank performance
  • Segmented transactions into spending bands using CASE logic to identify top-performing customers and products
  • Broke down revenue by branch, category, and customer to surface where value is concentrated

Key Insights

Revenue is heavily concentrated in Electronics. Electronics generated £800,000 in revenue — more than six times Fashion (£115,000) and Food (£114,000), and over 30x Home Care (£23,000). Category performance here isn't close; Electronics is carrying the business.

A handful of customers drive most of the value. The top 3 customers by revenue show a steep drop-off: Customer 3 at £550,000, Customer 2 at £250,000, and Customer 1 at £90,000. The top customer alone generated more than the second and third combined — a strong signal for where a loyalty or retention program would pay off first.


Sample Queries

-- Top 3 Customers by Revenue
SELECT c.customer_id, SUM(unit_price * quantity) AS revenue
FROM sales_transactions s
JOIN customers c ON c.customer_id = s.customer_id
GROUP BY c.customer_id
ORDER BY revenue DESC
LIMIT 3;

-- Revenue by Category
SELECT p.category, SUM(s.unit_price * s.quantity) AS revenue
FROM sales_transactions s
JOIN products p ON s.product_id = p.product_id
GROUP BY p.category
ORDER BY revenue DESC;

Top 3 Customers Query Revenue by Category Query Query Set — Total Revenue, Revenue by Branch, Top Branch


Why Spreadsheets

Not applicable here — this project intentionally works directly against structured data in SQL rather than a spreadsheet layer, since multi-table joins and aggregate logic at this scale are a better fit for a query engine than pivot tables.


Files Included

  • retail_sales_analysis.sql
  • README.md

Author

Emmanuella Alao Data Analyst | Business Intelligence Analyst | AI Solutions Developer

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors