← Back to list

Retail Sales Analysis Using SQL: A Data Analyst Case Study

Dataleum Data Analytics Internship (2025)

Ridwanullahi Ayoola - Data Analyst · 2025-12-20 20:18 · 0 claps · 3.7 min read
#data-internship #data-analytics #data-analysis #sql #data-analyst
Open on Medium ↗
Wiki topics: GRW · Growth & Analytics

Retail Sales Analysis Using MySQL: A Data Analyst Case Study

By Ridwanullahi Ayoola — Dataleum SQL Internship Project (2025)

SQL for Data Science

SQL for Data Science

Project Overview

This project was completed as part of the Dataleum Internship Programme and focuses on analysing retail sales data using MySQL.

The objective was to extract actionable business insights from transactional retail data by writing efficient SQL queries that answer key business questions related to:

  • Sales performance
  • Customer purchasing behaviour
  • Product performance
  • Revenue trends
  • Operational insights

The analysis demonstrates my ability to use SQL for data exploration, aggregation, and decision support in a real-world business context.

Tools & Technologies

  • SQL (MySQL)
  • CSV dataset (imported into relational database)
  • SQL concepts applied: Data Definition Language, Data Manipulation Language, Aggregation Clauses, Aggregate Functions, Joins, Subqueries

Photo by Caspar Camille Rubin on Unsplash

Photo by Caspar Camille Rubin on Unsplash

Dataset Description

The dataset contains transactional retail sales records, including:

  • Transaction and order details
  • Product categories
  • Customer information
  • Sales quantity and revenue fields
  • Date and time attributes

This structure allowed for both time-based analysis and customer/product-level insights.

Data Preparation

Before analysis, the dataset was:

  • Imported into a SQL database
  • Checked for missing or invalid values
  • Verified for correct data types (dates, numeric fields, text fields)

Basic validation ensured reliable query outputs and accurate aggregations.

1. Sales Performance Analysis

Using SQL aggregation queries, I analysed overall sales performance across the dataset.

Key SQL techniques used

  • Aggregating total sales using SUM()

  • Identifying sales trends using GROUP BY on time attributes

  • Ranking results using ORDER BY

Insights

  • Sales are unevenly distributed across products and time periods
  • A small subset of products contributes a significant share of total revenue
  • Certain periods show stronger sales activity than others

These findings help identify high-impact products and peak business periods.

2. Product Performance Analysis

SQL queries were used to evaluate product-level performance:

  • Total revenue by product category

  • Quantity sold by product

  • Best and worst performing items

Insights

  • Some product categories consistently outperform others
  • Low-performing products contribute minimal revenue and may require pricing, promotion, or inventory review

This analysis supports product assortment optimisation.

3. Customer Behaviour Analysis

Customer-focused queries explored:

  • Purchase frequency
  • Total spend per customer
  • Average transaction value

Insights

  • A small group of customers generates a large portion of revenue
  • High-value customers present strong opportunities for loyalty and retention strategies

Understanding customer concentration is critical for targeted marketing.

4. Time-Based Analysis

Using date fields, I analysed:

  • Sales distribution over time
  • Transaction volume patterns

Insights

  • Sales activity fluctuates across different time periods
  • Identifying high-activity periods can support staffing, promotions, and inventory planning

Key SQL Queries (Approach Summary)

The project relied on:

  • Aggregation queries to compute totals and averages
  • Sorting and filtering to identify top-performing entities
  • Grouping to compare performance across categories and customers

Each query was written with readability, efficiency, and business relevance in mind.

Key Insights Summary

  • Revenue is concentrated among a limited number of products and customers
  • Certain product categories dominate overall sales
  • Customer purchasing behaviour shows clear high-value segments
  • SQL is highly effective for answering business questions directly from raw data

Business Recommendations

Based on the SQL analysis:

  1. Prioritise high-performing products Focus inventory and marketing efforts on products driving the most revenue.
  2. Develop retention strategies for top customers Introduce loyalty programmes or targeted incentives.
  3. Review low-performing products Consider repricing, promotion, or discontinuation.
  4. Use time-based insights for planning Align promotions and staffing with peak sales periods.

Conclusion

This project demonstrates how SQL can be used to transform raw retail data into meaningful business insights. Through structured querying and analytical thinking, I was able to support decisions related to sales optimisation, customer management, and operational efficiency.

The project highlights my ability to:

  • Translate business questions into SQL queries
  • Analyse transactional datasets
  • Communicate insights clearly and professionally

Connect With Me


메타데이터
post_id
bf47d4a3ab67
slug
retail-sales-analysis-using-sql-a-data-analyst-case-study-bf47d4a3ab67
url
https://medium.com/@ridwanayoola39/retail-sales-analysis-using-sql-a-data-analyst-case-study-bf47d4a3ab67
canonical_url
https://medium.com/@ridwanayoola39/retail-sales-analysis-using-sql-a-data-analyst-case-study-bf47d4a3ab67
author_url
https://medium.com/@ridwanayoola39
status
ok
fetched_at
2026-08-05 18:10:35