Skip to content

SuperMBA/customer-segmentation-sql

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 

Repository files navigation

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 | img | 2 | Transaction amount by month and industry | img | 3 | Online purchases of IT customers by brand | img | 4 | Total, minimum and maximum transaction amount per customer | img | 5 | Customer metrics calculated with window functions | img | 6 | Customer with the lowest spending | img | 7 | Customer with the highest spending | img | 8 |First transaction for each customer | img | 9 | Customer with the longest interval between transactions | img | 10 |Top 10 customers by interval between purchases | img


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.

About

SQL-based customer segmentation project using PostgreSQL queries, joins, aggregations, window functions and transaction analysis.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors