Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started
SQL for Renewal Performance
00:00
5 left

SQL for Renewal Performance

MediumSQL · PostgreSQL

Problem

Write a SQL query to analyze renewal performance by month, segment, and owner, including conversion rate and churn rate.

Use the provided renewal, account, and owner data. Treat every renewal record as eligible, classify outcomes by status, and preserve renewals whose account or owner is unavailable.

Output

  1. One row per renewal month, segment, and owner.
  2. Columns: renewal_month, segment, owner_name, renewal_count, converted_count, churned_count, conversion_rate, and churn_rate.
  3. Rates are percentages rounded to two decimal places. Order by month, segment, and owner name ascending.

Schema

renewal_opportunities
ColumnTypeDescription
renewal_idPKINTUnique renewal record identifier
account_idINTRenewing account identifier
owner_idINTAccount owner identifier
renewal_dateDATEScheduled renewal date
statusVARCHAR(20)Renewal outcome
accounts
ColumnTypeDescription
account_idPKINTUnique account identifier
account_nameVARCHAR(100)Customer account name
segmentVARCHAR(30)Customer segment
owners
ColumnTypeDescription
owner_idPKINTUnique owner identifier
owner_nameVARCHAR(100)Renewal owner name
teamVARCHAR(50)Owner team
Tablesrenewal_opportunitiesaccountsowners
Interviewer

Your question is SQL for Renewal Performance. Start with the requirements and the three tables in the Question tab.

Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.

You need to log in / sign up to run or submit.
CodePostgreSQL
You need to log in / sign up to run or submit.Ln 1
Run your query to see results here.