Compute Lease Renewal Rate by Property From Lease Records

Last updated: November 29, 2026

Quick Overview

Given a leases table, write SQL that returns, for each property, the share of leases ending in the last 90 days that were renewed by the same resident, along with the count of expiring leases.

EliseAI
Data Manipulation (SQL/Python)
Data Scientist
EliseAI
November 29, 2026
Data Scientist
Technical Screen
Data Manipulation (SQL/Python)
Easy

0

0

0 solved


Given a leases table, write SQL that returns, for each property, the share of leases ending in the last 90 days that were renewed by the same resident, along with the count of expiring leases.

Renewals are a resident workflow the AI handles (offers, reminders, signatures), and operators judge it by renewal rate per property. The screen checks basic joins, date filtering, and defining the denominator correctly.

What the Interviewer Expects
  • Clarify what counts as a renewal
  • Use a self join or EXISTS to find the follow-on lease
  • Filter the denominator to leases that actually ended in the window
  • Avoid integer division
  • Order and present results sensibly
Key Topics to Cover
SQL joins
EXISTS
date filtering
rate metrics
How to Approach This
  1. Clarify the schema and expected output format before writing queries.
  2. Use CTEs (WITH clauses) to break complex queries into readable steps.
  3. Consider window functions (ROW_NUMBER, RANK, LAG, LEAD) for ranking and sequential analysis.
  4. Watch for NULLs, duplicates, and edge cases in JOINs and GROUP BY.
  5. For pandas, prefer vectorized operations over row-by-row iteration.
Possible Follow-up Questions
  • How do you treat a resident who transferred to a different unit in the same property?
  • Leases ending in the last two weeks may not have a renewal recorded yet: how do you handle that lag?
  • Break the rate out by whether the AI sent a renewal offer.
  • How would you compute this monthly as a trend?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice SQL Problems
Sample Answer
Clarify the Data

Assume leases(lease_id, property_id, unit_id, resident_id, start_date, end_date). A renewal means the same resident has another lease at the same property starting within 30 days of the old end date...

Approach

Filter expiring leases, then for each check with EXISTS whether a follow-on lease exists. Aggregate per property with AVG over a 0/1 flag so the division is a float....


Submit Your Answer
Markdown supported

Related Questions