Skip to content

About

A PostgreSQL project analysing Superstore sales, profit, regional performance, and product profitability.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

Superstore Sales and Profitability Analysis | PostgreSQL

Project overview

This personal SQL practice project explores sales and profitability using a historical Sample Superstore dataset. A retail sales manager's request provides a fictional scenario; this is not a client engagement.

The goal is to assess overall performance, compare regions and sub-categories, explore monthly trends, and identify product combinations associated with high profits or losses.

Tools and techniques

  • PostgreSQL and pgAdmin
  • SELECT, WHERE, IS NULL, COUNT(DISTINCT ...), SUM, ROUND, MIN, MAX, GROUP BY, HAVING, DATE_TRUNC, ORDER BY and LIMIT

Dataset

The supplied file has 9,994 order-line records, representing 5,009 distinct orders. Order dates run from 2014-01-03 to 2017-12-30. The full file was analysed.

Each row represents an order line, not a unique order. The currency is not confirmed, so values are shown in the dataset's reported units.

  • Kaggle source: Superstore Dataset, uploaded by Vivek Chowdhury (vivek468); downloaded 31 October 2026.
  • Upstream source: The Kaggle uploader says the data came from a Tableau community page and credits its original creators. The uploader says it is for educational purposes only.
  • Licence: The Kaggle page states “Other (specified in description)”. The description does not establish a clear permission to redistribute the dataset. The CSV is therefore not included here; confirm rights separately before sharing it.

The analysed CSV is a prepared version of the dataset, with UTF-8 encoding and ISO dates. The provided working CSV contained day/month/year dates before conversion; do not assume that every copy of the source uses that date format. The working CSV also has an additional unique_id column beyond the 21 columns listed on the Kaggle source page; its provenance is not established and it is not used in the analysis queries.

Questions explored

  1. How many distinct orders are there, and what period do they cover?
  2. Are key fields missing, or are any row IDs duplicated?
  3. What are overall sales, profit, quantity sold and profit margin?
  4. How do sales and profit vary by region and sub-category?
  5. What do monthly sales and profit look like?
  6. Which product ID and product-name combinations have the highest and lowest total profit?

Findings

  • Overall: Sales were approximately 2,297,201, profit was approximately 286,397, and the profit margin was 12.47%. The dataset records 37,873 units sold.
  • Regions: West had the highest sales and profit. Central's sales (501,240) exceeded South's (391,722), but Central's profit (39,706) was lower than South's (46,749). Central had the lowest regional margin at 7.92%.
  • Loss-making sub-categories: Tables, Bookcases and Supplies made overall losses. Tables generated approximately 206,966 in sales but recorded a loss of approximately 17,725, with a -8.56% margin.
  • Product combinations: TEC-CO-10004722 / Canon imageCLASS 2200 Advanced Copier recorded approximately 25,200 in total profit. TEC-MA-10000418 / Cubify CubeX 3D Printer Double Head Print recorded an overall loss of approximately 8,880.

The SQL groups products by both product ID and name. A separate review of the supplied CSV found 32 product IDs associated with more than one name, so interpret the ranking as ID-and-name combinations, not necessarily one total per product ID.

Data quality and limitations

  • The SQL checks found no NULL values in order_id, order_date, sales or profit, and no repeated row_id values. This is not a complete data-quality audit; SQL NULL checks do not by themselves identify blank text.
  • Profit margin is SUM(profit) / SUM(sales) × 100. The SQL displays sales and profit rounded to whole numbers and the margin to two decimal places.
  • The data is historical and descriptive. Differences and losses do not prove their causes. More investigation would be needed before making business decisions.

How to reproduce

  1. Obtain the dataset from the original source and check its terms of use and attribution.
  2. Prepare a UTF-8 CSV with YYYY-MM-DD dates and a header row. Check the date format of your source copy before converting it.
  3. Create a PostgreSQL database. Open Superstore.sql in pgAdmin, select only the CREATE TABLE statement and run it once. If the table already exists, skip this step.
  4. Right-click superstore → Import/Export Data in pgAdmin. Choose Import, CSV, UTF8, Header on, comma delimiter, and double quotes for Quote and Escape. Select the matching table columns in CSV order. For the 21-column Kaggle source, select the first 21 columns and omit unique_id; it will be NULL and is not used by the analysis. For the 22-column working copy, select all 22. Import the CSV only once.
  5. Select and execute the remaining analysis queries individually.

Project file

  • Superstore.sql: the original table definition and PostgreSQL analysis queries.

Possible next steps

Investigate discount levels and other available fields in loss-making areas, without presenting potential associations as established causes. A future project could visualise the results in Power BI.

About

A PostgreSQL project analysing Superstore sales, profit, regional performance, and product profitability.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors