Your question is Time-to-Conversion SQL by Channel. Start with the requirements and the two tables on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Aircall's marketing team wants to compare how quickly leads from LinkedIn and Google Ads convert. Assume the query runs on 2026-08-29, and define the six-month period as the interval beginning six months before the run date.
Write a PostgreSQL query that calculates the average time from lead creation to conversion for each requested source.
LinkedIn or Google Ads.| Column | Type | Description |
|---|---|---|
| lead_idPK | BIGINT | Unique lead identifier |
| source | VARCHAR(50) | Marketing acquisition source |
| created_at | TIMESTAMP | Timestamp when the lead entered the marketing funnel |
| Column | Type | Description |
|---|---|---|
| conversion_idPK | BIGINT | Unique conversion record identifier |
| lead_id | BIGINT | Lead associated with the conversion |
| converted_at | TIMESTAMP | Timestamp when the lead converted |