This repository contains my solutions for the SQL Proficiency Assessment aimed at analyzing customer behavior, account activity, and value estimation.
Goal: Identify customers who have both funded savings and investment plans.
Approach:
- Used
LEFT JOINto connect savings and plans. - Ensured both types of products are funded.
- Aggregated and sorted by total deposits (converted from kobo to naira).
Goal: Segment customers by transaction frequency.
Approach:
- Calculated monthly transactions per user.
- Averaged per user to get monthly activity.
- Categorized based on thresholds and aggregated.
Goal: Find active accounts with no inflow in the last year.
Approach:
- Fetched last transaction per account.
- Filtered those older than 365 days.
- Tagged by type (Savings or Investment).
Goal: Estimate CLV using transaction volume and tenure.
Approach:
- Calculated tenure in months.
- Used CLV formula:
(transactions/tenure)*12*avg_profit. - Ensured data sanity with
NULLIFandCOALESCE.
- Kobo Conversion: All amounts were in kobo; needed to divide by 100.
- Data Gaps: Assumed presence of
transaction_dateand validdate_joined. - Edge Cases: Guarded against zero division using
NULLIF.
Each .sql file is standalone. Execute them on the provided schema using your SQL client or terminal.