Customer Segmentation with SQL Project Overview
This project demonstrates customer behavior analysis using SQL queries in PostgreSQL. The analysis is based on two relational tables: customers and transactions.
The project focuses on extracting business insights from transactional data using SQL techniques such as joins, aggregations, window functions and date operations. It was developed and tested in DBeaver, with screenshots of query outputs included in the repository.
Business Context
Customer segmentation is a common analytical task used to understand customer behavior, identify high-value clients, analyze purchasing patterns and support data-driven decision-making.
This project answers practical analytical questions such as:
How are customers distributed across industries? Which industries generate the highest transaction volume? Which brands are popular among online IT customers? Who are the customers with the highest and lowest spending? What is the time interval between customer transactions? Which customers have the longest purchase gaps? Repository Structure customer-segmentation-sql/ ├── images/ # Screenshots of SQL query results ├── sql_queries/ # SQL scripts └── README.md # Project documentation SQL Techniques Used
The project demonstrates the following SQL skills:
SELECT, WHERE, LIMIT
JOIN
GROUP BY
ORDER BY
Aggregations: COUNT(), SUM(), MIN(), MAX()
Window functions: ROW_NUMBER() OVER (...)
Date operations: TO_CHAR, MAX(date) - MIN(date)
Customer-level and industry-level analysis
Transaction-based behavioral segmentation
Analytical Questions
| Analytical Questions
|----|----------------------------------------------------------------|--------------------------------------------------|
| 1 | Number of customers by industry |
| 2 | Transaction amount by month and industry |
| 3 | Online purchases of IT customers by brand |
| 4 | Total, minimum and maximum transaction amount per customer |
| 5 | Customer metrics calculated with window functions |
| 6 | Customer with the lowest spending |
| 7 | Customer with the highest spending |
| 8 |First transaction for each customer |
| 9 | Customer with the longest interval between transactions |
| 10 |Top 10 customers by interval between purchases | 
Example Insights
The SQL queries help identify:
customer distribution across different industries; industries and months with higher transaction activity; brand preferences among online customers; high-value and low-value customers; customers with long purchase gaps; patterns that can support segmentation and retention analysis.