Skip to content

dhyanii-analytics/SQL-Retail-Sales-Analysis

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🛒 TechTrends: Retail Sales SQL Analysis

📌 Project Overview

This project simulates a real-world data analysis workflow for a fictional electronics retailer, "TechTrends." The goal was to transform raw sales data into actionable business insights using SQL.

Key Objectives:

  • Revenue Analysis: Determine which product categories drive the most sales.
  • Customer Segmentation: Identify VIP clients based on spending thresholds.
  • Trend Analysis: Track sales volume over time (monthly trends).

🛠️ Tools & Skills

  • SQL Dialect: MySQL / PostgreSQL
  • Key Skills: JOINS, Aggregate Functions, CASE Statements, Date Extraction, Normalization.

📸 Project Execution Gallery

Phase 1: Database Setup

First, I designed a normalized schema with three tables: Customers, Products, and Sales. Schema Creation Inserting Mock Data

Phase 2: The "Master" View (Complex Joins)

I joined all three tables to create a comprehensive view of every transaction, calculating the total cost dynamically. Master Join Query Result: Master Join Result

Phase 3: Aggregation & Revenue Analysis

Here, I grouped sales by customer to calculate the total lifetime value (LTV) of each client. Group By Customer Query Result: Group By Customer Result

Phase 4: Time-Series Analysis

I extracted the month from the transaction timestamp to track sales volume trends over time. Monthly Trend Query Result: Monthly Trend Result

Phase 5: Advanced Business Logic (Customer Segmentation)

Using CASE statements, I automatically labeled customers as "VIP" or "Standard" based on their spending history ($500 threshold). Case Statement Query Result: Case Statement Result


🚀 Conclusion

This project demonstrates the ability to take raw, scattered data and turn it into clear business metrics. By using advanced SQL techniques like CASE logic and multi-table JOINs, I was able to identify that Electronics are our primary revenue driver and successfully segment our high-value customers.

📂 How to Run

  1. Clone this repository.
  2. Open the tech_trends_analysis.sql file in any SQL environment.
  3. Run the script to generate the database and view the insights.

About

A SQL project analyzing customer purchase behavior and revenue trends.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors