Customers Transaction Analysis

Project Overview
This project involved designing and implementing a relational database using PostgreSQL. The system managed inventory, sales, and customer data. I also built a small web interface with Flask for data entry and reporting. The project showcases skills in database design, SQL querying, and building data-driven applications.
Project Overview
Customers who left within the last month - the column is called Churn Services that each customer has signed up for - phone, multiple lines, internet, online security, online backup, device protection, tech support, and streaming TV and movies Customer account information - how long they've been a customer, contract, payment method, paperless billing, monthly charges, and total charges Demographic info about customers - gender, age range, and if they have partners and dependents Inspiration To explore this type of models and learn more about the subject.
Code Snippet
SELECT
owner_id,
name,
SUM(savings_plan) savings_count,
SUM(Investment_plan) investment_count,
SUM(total_deposits) total_deposits
FROM
(SELECT
name,
owner_id,
Investment_plan,
savings_plan,
total_deposits
FROM
(SELECT
name,
owner_id,
Investment_plan,
savings_plan,
CASE
WHEN investment_plan = 0 AND savings_plan = 1 THEN 'savings'
WHEN investment_plan = 1 AND savings_plan = 0 THEN 'investment'
ELSE 'non'
END AS 'savings_investment_remark',
total_deposits
FROM
(SELECT
CONCAT(customuser.first_name, ' ', customuser.last_name) AS name,
savings.owner_id,
plan.is_a_fund investment_plan,
plan.is_regular_savings savings_plan,
savings.confirmed_amount total_deposits
FROM
users_customuser customuser
JOIN savings_savingsaccount savings ON customuser.id = savings.id
JOIN plans_plan plan ON savings.owner_id = plan.owner_id) subquery1) subquery2
WHERE
(savings_investment_remark = 'savings'
OR savings_investment_remark = 'investment')
AND total_deposits != 0) subquery3
GROUP BY name , owner_id
HAVING savings_count != 0
AND investment_count != 0
ORDER BY total_deposits;



















