Portfolio Project — April 2026

Sales &
Profit Analysis
using PostgreSQL

An end-to-end SQL analysis of retail superstore data — uncovering revenue patterns, loss-making orders, and state-wise performance using PostgreSQL and pgAdmin.

NamePurv D
CourseBMS
ToolsPostgreSQL · pgAdmin 4
$1,988
Total Sales Generated
−$112
Net Profit (Loss)
3
States Analyzed
5
SQL Queries Written
Kentucky → Top State
Highest revenue at $993.90 · Florida driving losses
// Project Overview

What this project set out to solve

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.

// SQL Analysis

Queries & Findings

Query 01
Total Sales

Calculates the aggregate sum of all sales transactions in the superstore table to understand the business's top-line revenue.

$1,988.47 total sales
-- Calculate total revenue SELECT SUM(sales) AS total_sales FROM superstore;
Query 02
Sales by State

Groups and ranks all orders by state, sorted descending to identify top and bottom performing regions.

Kentucky leads at $993.90
-- State-level revenue breakdown SELECT state, SUM(sales) AS sales FROM superstore GROUP BY state ORDER BY sales DESC;
Query 03
Top Customers

Ranks customers by their total purchase value, enabling targeted retention and marketing strategies.

Claire Gute — #1 at $993.90
-- Rank customers by spend SELECT customer_name, SUM(sales) AS total_spent FROM superstore GROUP BY customer_name ORDER BY total_spent DESC;
Query 04
Loss-Making Orders

Filters all orders with a negative profit value to identify which specific transactions are pulling the business into a loss.

1 order flagged (Florida)
-- Filter orders losing money SELECT * FROM superstore WHERE profit < 0;
Query 05
Total Profit

Aggregates profit across all orders to reveal the net business result. Despite solid sales, high discounts erode margin significantly.

Net loss of −$112.15
-- Calculate net profitability SELECT SUM(profit) AS total_profit FROM superstore;

State Performance Summary

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
// Key Insights

What the data reveals

📊
Revenue ≠ Profit

$1,988 in sales but −$112 net profit. Strong top-line numbers mask a serious margin problem caused by discounting and shipping costs.

📍
Florida is the Problem State

Despite being the #2 revenue state, Florida is the primary source of losses. High discount rates and Standard Class shipping erode margins completely.

🏆
Kentucky Leads Profitability

Kentucky generates the highest sales at $993.90 and is the most profitable region — a model for how other states should be managed.

👤
Two Customers Drive 99% of Sales

Claire Gute and Sean O'Donnell together account for nearly all revenue — highlighting high customer concentration risk.

⚠️
Loss Orders Must Be Flagged

Some orders generate revenue but produce negative profit. A real-time profitability threshold system should be implemented at order entry.

🔧
Strategic Action Required

Pricing strategy, discount controls, and shipping mode optimization are the three levers that could turn this business profitable.

What was applied in this project

PostgreSQL — Relational Database Management
SQL Aggregate Functions — SUM(), GROUP BY
Data Filtering — WHERE clause, conditionals
Sorting & Ranking — ORDER BY DESC/ASC
pgAdmin 4 — GUI query execution & schema management
Business Analysis — Translating SQL output to insights
Financial Reporting — Revenue vs. profit understanding
Retail Data Analysis — Superstore dataset exploration
Data Storytelling — Structured project documentation
// Conclusion

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.

Project TypeFinance Data Analysis
TechnologyPostgreSQL · pgAdmin 4 · SQL
CourseBMS — April 2026
AuthorPurv D