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.
- PostgreSQL and pgAdmin
SELECT,WHERE,IS NULL,COUNT(DISTINCT ...),SUM,ROUND,MIN,MAX,GROUP BY,HAVING,DATE_TRUNC,ORDER BYandLIMIT
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.
- How many distinct orders are there, and what period do they cover?
- Are key fields missing, or are any row IDs duplicated?
- What are overall sales, profit, quantity sold and profit margin?
- How do sales and profit vary by region and sub-category?
- What do monthly sales and profit look like?
- Which product ID and product-name combinations have the highest and lowest total profit?
- 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.
- The SQL checks found no
NULLvalues inorder_id,order_date,salesorprofit, and no repeatedrow_idvalues. This is not a complete data-quality audit; SQLNULLchecks 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.
- Obtain the dataset from the original source and check its terms of use and attribution.
- Prepare a UTF-8 CSV with
YYYY-MM-DDdates and a header row. Check the date format of your source copy before converting it. - Create a PostgreSQL database. Open
Superstore.sqlin pgAdmin, select only theCREATE TABLEstatement and run it once. If the table already exists, skip this step. - 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 omitunique_id; it will beNULLand is not used by the analysis. For the 22-column working copy, select all 22. Import the CSV only once. - Select and execute the remaining analysis queries individually.
Superstore.sql: the original table definition and PostgreSQL analysis queries.
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.