A comprehensive, enterprise-grade database schema for managing gold loan operations with complete workflow automation, multi-level approvals, and advanced analytics.
┌─────────────┐ ┌──────────────┐ ┌─────────────┐
│ Customers │────────▶│ Applications │────────▶│ Loans │
└─────────────┘ └──────────────┘ └─────────────┘
│ │ │
│ │ │
▼ ▼ ▼
┌─────────────┐ ┌──────────────┐ ┌─────────────┐
│ Gold Assets │ │ Approvals │ │ Payments │
└─────────────┘ └──────────────┘ └─────────────┘
- Tables: 13 core + 3 views
- Stored Procedures: 2
- Indexes: 35+ optimized indexes
- Database: MySQL 8.0+ or PostgreSQL 13+
- Normalization: 3NF with strategic denormalization
- Design Pattern: Star schema for analytics
| Table | Description | Key Fields |
|---|---|---|
customers |
Customer master data | customer_id, pan_number, kyc_verified |
gold_assets |
Gold items catalog | asset_id, net_weight, purity_id, assessed_value |
loan_applications |
Application workflow | application_id, status, requested_amount |
loans |
Active loan accounts | loan_id, outstanding_principal, loan_status |
payments |
Payment transactions | payment_id, principal_paid, interest_paid |
employees |
Staff and officers | employee_id, role_id, branch_id |
branches |
Branch locations | branch_id, branch_code, branch_name |
loan_schemes |
Product configurations | scheme_id, interest_rate, loan_to_value_ratio |
loan_approvals |
Approval workflow | approval_id, approval_status, approver_id |
disbursements |
Loan payouts | disbursement_id, disbursement_mode |
vw_customer_loan_summary- Customer portfolio overviewvw_application_pipeline- Pending applications dashboardvw_loan_performance- Loan portfolio health metrics
sp_calculate_eligible_loan()- Calculate maximum loan eligibility based on collateralsp_disburse_loan()- Process loan disbursement with atomic transactions
SELECT customer_name, active_loans, total_outstanding, total_collateral_value
FROM vw_customer_loan_summary
WHERE active_loans > 0
ORDER BY total_outstanding DESC
LIMIT 10;SELECT
l.loan_account_number,
CONCAT(c.first_name, ' ', c.last_name) as customer_name,
l.outstanding_principal,
DATEDIFF(CURRENT_DATE, l.maturity_date) as days_overdue
FROM loans l
JOIN customers c ON l.customer_id = c.customer_id
WHERE l.loan_status = 'OVERDUE'
ORDER BY days_overdue DESC;SELECT
b.branch_name,
COUNT(l.loan_id) as total_loans,
SUM(l.principal_amount) as total_disbursed,
SUM(l.outstanding_principal) as total_outstanding,
ROUND(AVG(l.interest_rate), 2) as avg_interest_rate
FROM branches b
LEFT JOIN loans l ON b.branch_id = l.branch_id
GROUP BY b.branch_id, b.branch_name;SELECT
gps.purity_level,
COUNT(*) as item_count,
SUM(ga.net_weight) as total_weight_grams,
SUM(ga.assessed_value) as total_value
FROM gold_assets ga
JOIN gold_purity_standards gps ON ga.purity_id = gps.purity_id
WHERE ga.status = 'PLEDGED'
GROUP BY gps.purity_level;Romi Gupta
- GitHub: @MasterMindRomii
- Project: MySQL Gold Loan Application
Note: This is an assignment project designed for the NATFLOW assessment. For production deployment, ensure proper security hardening, compliance reviews, and load testing.
Created by Romi Gupta