Welcome to a comprehensive SQL project designed for deep data exploration, performance benchmarking, and KPI-driven reporting. This repository contains a suite of advanced SQL scripts that transform raw sales, product, and customer data into actionable insights for business intelligence and strategic decision-making.
Creates a SQL view report_products
that consolidates product-level metrics and segments performance by revenue tiers.
Key Features:
- Aggregates total orders, sales, quantity sold, and unique customers
- Calculates KPIs: recency, average order revenue (AOR), average monthly revenue
- Segments products into High, Mid, and Low performers
- Computes lifespan and selling price metrics
Creates a SQL view report_customers
that summarizes customer-level metrics and segments users by age and spending behavior.
Key Features:
- Combines customer demographics with transaction history
- Segments customers into VIP, Regular, and New based on lifespan and spend
- Groups customers by age brackets (e.g., 20–30, 30–40)
- Calculates KPIs: recency, average order value, average monthly spend
- Tracks total orders, products purchased, and customer lifespan
Track how key metrics evolve across months and years to uncover trends and seasonality.
- Sales performance by year and month
- Monthly breakdowns across years
Progressively aggregates data to visualize business growth or decline.
- Cumulative sales by month
- Rolling average of customer count
Compare current values to historical averages and previous periods using window functions.
- Year-over-year product sales comparison
- Flags for growth, decline, or stability
Understand category-level contributions to overall sales.
- Category sales as percentage of total
Group entities based on value ranges or behavioral patterns.
- Product segmentation by cost range
- Customer segmentation into VIP, Regular, and New based on spending and history
- SQL Server (T-SQL syntax)
- Window functions
- Common Table Expressions (CTEs)
- Aggregation and date functions
sql-analysis, data-exploration, product-reporting, customer-reporting, kpi-dashboard, sales-insights, sql-project, business-intelligence, advanced-sql, data-analytics, revenue-segmentation, customer-segmentation, window-functions
Feel free to fork, contribute, or raise issues. This project is open for collaboration and learning.