PracHub
QuestionsPremiumLearningGuidesInterview PrepNEWCoaches

Quick Overview

This question evaluates proficiency with SQL window functions and time-series aggregation, specifically the ability to compute rolling metrics across customer segments by aggregating defaults and accounts over a moving 12-month window.

  • Medium
  • Citibank
  • Data Manipulation (SQL/Python)
  • Data Scientist

Write SQL for rolling default rates

Company: Citibank

Role: Data Scientist

Category: Data Manipulation (SQL/Python)

Difficulty: Medium

Interview Round: Technical Screen

Write a SQL query to compute 12‑month rolling default rates by customer segment. Assume table loans(month DATE, segment TEXT, defaults INT, accounts INT). For each segment and month, compute SUM(defaults) over the current and prior 11 months divided by SUM(accounts) over the same window.

Quick Answer: This question evaluates proficiency with SQL window functions and time-series aggregation, specifically the ability to compute rolling metrics across customer segments by aggregating defaults and accounts over a moving 12-month window.

Last updated: Mar 29, 2026

Loading coding console...

PracHub

Master your tech interviews with 7,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.