An end-to-end SQL analysis of retail superstore data — uncovering revenue patterns, loss-making orders, and state-wise performance using PostgreSQL and pgAdmin.
Using the Superstore retail dataset, this project applies structured SQL queries in PostgreSQL to answer key business questions: Where is revenue coming from? Which customers are most valuable? Where is the business losing money? The analysis moves from raw data to structured insights using aggregate functions, filtering, and ranking.
Calculates the aggregate sum of all sales transactions in the superstore table to understand the business's top-line revenue.
$1,988.47 total salesGroups and ranks all orders by state, sorted descending to identify top and bottom performing regions.
Kentucky leads at $993.90Ranks customers by their total purchase value, enabling targeted retention and marketing strategies.
Claire Gute — #1 at $993.90Filters all orders with a negative profit value to identify which specific transactions are pulling the business into a loss.
1 order flagged (Florida)Aggregates profit across all orders to reveal the net business result. Despite solid sales, high discounts erode margin significantly.
Net loss of −$112.15| State | Total Sales | Top Customer | Profit Status | Key Issue |
|---|---|---|---|---|
| Kentucky | $993.90 | Claire Gute | Profitable | — |
| Florida | $979.95 | Sean O'Donnell | Loss-Making | High discounts · Standard Class shipping |
| California | $14.62 | Darrin Van Huff | Marginal | Low order volume |
$1,988 in sales but −$112 net profit. Strong top-line numbers mask a serious margin problem caused by discounting and shipping costs.
Despite being the #2 revenue state, Florida is the primary source of losses. High discount rates and Standard Class shipping erode margins completely.
Kentucky generates the highest sales at $993.90 and is the most profitable region — a model for how other states should be managed.
Claire Gute and Sean O'Donnell together account for nearly all revenue — highlighting high customer concentration risk.
Some orders generate revenue but produce negative profit. A real-time profitability threshold system should be implemented at order entry.
Pricing strategy, discount controls, and shipping mode optimization are the three levers that could turn this business profitable.
This project proves that strong sales alone don't guarantee a healthy business. Through structured SQL analysis, I identified a $112 profit gap, pinpointed Florida as the loss-driving state, and surfaced actionable recommendations — all from a structured dataset and five queries.