Back to Portfolio
Consumer Electronics MySQL Inventory Optimization Global Supply Chain Customer Satisfaction

SQL-Driven Inventory Optimization

A MySQL-powered inventory optimization system for TechElectro Inc. — a global consumer electronics leader — eliminating costly overstock and stockout cycles through data-driven inventory level management, enabling better customer satisfaction and a sharper competitive edge.

3
Datasets Analysed
MySQL
Primary Tool
Global
Market Reach
3
Core Challenges Solved

Objective & Problem

The Objective

The primary goal was to implement a sophisticated inventory optimization system using MySQL that addresses TechElectro Inc.'s chronic overstocking and stockout challenges — enabling data-driven decision-making that reduces carrying costs, elevates customer satisfaction, and strengthens competitive positioning across global markets.


Specific aims included determining optimal stock levels per product SKU using MySQL analytics, automating inventory reporting, and providing actionable recommendations that supply chain managers could act on without requiring deep technical expertise.

About TechElectro Inc.

TechElectro Inc. is a globally recognized leader in consumer electronics manufacturing and distribution, offering an extensive product range from state-of-the-art smartphones to innovative home appliances. Operating across numerous countries, the company serves a diverse international customer base — making inventory accuracy a critical operational priority.


Despite its global reach and product breadth, TechElectro faced persistent inventory management failures that were directly damaging customer satisfaction and locking up capital in unsold goods — problems data analysis was well-positioned to solve.

Three inventory challenges driving the project:

A

Overstocking

Excessive inventory of certain products tied up substantial capital in unsold goods and consumed limited storage capacity — a direct cost to the business.

B

Understocking

High-demand products regularly suffered stockouts, generating missed sales opportunities and customer frustration when desired items were unavailable.

C

Customer Satisfaction Impact

Both overstock and stockout failures had a direct, measurable effect on customer satisfaction and loyalty — delays, stockouts, and inaccessible products eroded trust.


Data Description

Three datasets providing transactional, product, and macroeconomic context for inventory modelling.

Sales Data

  • Product ID — unique SKU identifier
  • Sales Date — date of each transaction
  • Sales Quantity (Units) — units sold per record
  • Product Cost (USD/Unit) — unit cost for margin analysis

Product Information

  • Product ID — links to sales data
  • Product Category — electronics segment type
  • Promotions — active promotion indicator per SKU

External Information

  • Sales Date — for time-series alignment
  • GDP (USD) — macroeconomic demand context
  • Inflation Rate (%) — pricing environment indicator
  • Seasonal Factor — dimensionless seasonality index

My Approach

An end-to-end MySQL analytics pipeline — from raw data preparation to a deployed optimization system.

Sample SQL — Identifying overstock and understock SKUs:

-- Flag SKUs as overstocked, understocked, or optimal
SELECT
  p.product_id,
  p.product_category,
  SUM(s.sales_quantity) AS total_units_sold,
  ROUND(AVG(s.sales_quantity) * 30, 0) AS optimal_monthly_stock,
  CASE
    WHEN current_stock > AVG(s.sales_quantity) * 45 THEN 'Overstocked'
    WHEN current_stock < AVG(s.sales_quantity) * 15 THEN 'Understocked'
    ELSE 'Optimal'
  END AS stock_status
FROM sales_data s
JOIN product_info p ON s.product_id = p.product_id
GROUP BY p.product_id, p.product_category
ORDER BY stock_status, total_units_sold DESC;

Metrics Tracked

Six core inventory and business performance dimensions monitored through MySQL analytics.

Stock Levels
Per-SKU inventory quantities benchmarked against optimal thresholds to flag overstock and understock positions
Sales Velocity
Daily and monthly units sold per product category — the baseline for reorder point and safety stock calculations
Carrying Costs
Capital tied up in excess inventory (USD) quantified per SKU to prioritize overstock reduction interventions
Stockout Rate
Frequency and duration of stockout events by product and category — linked to customer satisfaction impact
Seasonal Factor
External seasonality index applied to adjust optimal stock targets across quarterly demand cycles
Promo Impact
Sales uplift during promotional periods per SKU — used to pre-position stock ahead of demand spikes

Key Insights

What the SQL analysis revealed — and the business decisions it unlocks.

Overstock and understock follow category patterns, not random chance. EDA revealed that overstock concentrates in lower-velocity categories while stockouts hit high-demand segments hardest. Inventory reallocation — not additional procurement — can solve a significant portion of both problems simultaneously, without increasing total stock holding.
Seasonal demand cycles are predictable but being ignored. Cross-referencing the external seasonal factor index with sales velocity showed stock levels were not being adjusted for recurring demand cycles. Integrating seasonality into reorder point calculations would prevent the most frequent stockout events without raising average inventory costs.
Promotions drive demand spikes that drain stock without warning. Analysis of the promotions field against sales quantity confirmed consistent uplift during active promotion periods — but stock was not being pre-positioned for these events. Building promotional buffers into the SQL optimization model would directly cut stockout incidents during high-conversion windows.
Macroeconomic signals can sharpen demand forecasts before sales move. Incorporating inflation rate and GDP data from the external dataset revealed meaningful correlations with sales volume shifts — providing an early warning system for demand changes ahead of their appearance in transaction data, enabling proactive stock adjustments.
Automated reporting closes the gap between data and decision. The SQL-powered automated reporting system delivers real-time stock status flags — overstocked, understocked, or optimal — per SKU, replacing the manual monthly review cycle that previously left inventory imbalances undetected for weeks at a time.

Outcome & Impact

From Inventory Chaos to Data-Driven Precision

The delivered MySQL inventory optimization system gave TechElectro Inc. a clear, automated view of stock health across every product SKU — replacing guesswork with evidence. Supply chain managers gained real-time visibility into overstock and understock positions, optimal reorder thresholds, and promotional demand signals. The project reduced decision lag from weekly manual reviews to automated daily flags, freed up capital previously locked in excess inventory, and provided the data infrastructure to sustain customer satisfaction improvements at global scale.

Tech Stack

MySQLSQL JoinsAggregate FunctionsCASE StatementsSubqueriesQuery OptimizationReport AutomationEDA via SQLData TransformationInventory Modelling

Key Learning Points

  • Intermediate/Advanced SQL — multi-table joins, window functions, subqueries, and CASE logic for inventory classification
  • SQL Query Optimization — structuring efficient queries across large transactional datasets for performance at scale
  • Inventory Level Optimization — applying data-driven thresholds to eliminate overstock and understock simultaneously
  • Report Automation — building self-refreshing SQL scripts that deliver ongoing inventory intelligence to non-technical stakeholders

Interested in similar work?

Let's talk about how data can drive better decisions in your organization.