Write a SQL query using window functions to calculate a rolling 30-day delinquency rate by customer segment at Credit Saison India.
Use the provided customer, loan, and daily loan status data. Treat a loan as delinquent when days_past_due >= 30. The rate should use observations from the current date and preceding 29 calendar days.
Output
- One row per segment and status date with
segment, status_date, rolling_delinquent_loans, rolling_observed_loans, and rolling_delinquency_rate.
- Exclude records without a customer segment and order by
segment, then status_date.