Lead-to-Lease Funnel by Channel With First Response Time
Last updated: November 29, 2026
Quick Overview
Using leads, messages, tours and leases tables, write SQL that reports for each inbound channel (SMS, email, web chat, voice, listing site) the number of leads, median minutes to first outbound reply, tour rate and lease rate within 30 days of the lead.
EliseAI
November 29, 20260
0
0 solved
Using leads, messages, tours and leases tables, write SQL that reports for each inbound channel (SMS, email, web chat, voice, listing site) the number of leads, median minutes to first outbound reply, tour rate and lease rate within 30 days of the lead.
Speed to lead is the headline value of an AI leasing assistant, and operators want to see it next to conversion by channel. The interviewer checks multi-table aggregation without fan-out, window or percentile functions, and attribution windows.
What the Interviewer Expects
- Pre-aggregate each child table to one row per lead before joining
- Compute first response as the minimum outbound timestamp after lead creation
- Use a median (percentile_cont) rather than a mean for response time
- Apply a 30-day attribution window to tours and leases
- Explain how fan-out would inflate counts
Key Topics to Cover
How to Approach This
- Clarify the schema and expected output format before writing queries.
- Use CTEs (WITH clauses) to break complex queries into readable steps.
- Consider window functions (ROW_NUMBER, RANK, LAG, LEAD) for ranking and sequential analysis.
- Watch for NULLs, duplicates, and edge cases in JOINs and GROUP BY.
- For pandas, prefer vectorized operations over row-by-row iteration.
Possible Follow-up Questions
- How would you split first response time between AI replies and human replies?
- A prospect arrives through two channels: which channel gets credit?
- How do you show this per property with confidence that small properties are not noise?
- What index or partitioning would make this fast on a billion messages?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice SQL ProblemsSample Answer
Clarify the Data
leads(lead_id, property_id, channel, created_at), messages(lead_id, direction, sent_at) with direction in ('inbound','outbound'), tours(lead_id, scheduled_at, status), `leases(lead_id, signed_at...
Approach
Build one row per lead with three derived fields: first outbound reply time, whether a completed tour happened within 30 days, whether a lease was signed within 30 days. Each comes from its own groupe...