Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Offer Conversion Rate by Campaign

EasySQL · PostgreSQL00:00
Practice interviewer
In session
5 left
00:00

Your question is Offer Conversion Rate by Campaign. Start with the requirements and the one table 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.

You need to log in / sign up to run or submit.

Problem

You are given a table of customer-level offer outcomes from PNC marketing campaigns. Write a SQL query to calculate the percentage of customers who converted after receiving an offer for each campaign_name. Treat a customer as converted only when converted = TRUE. Return the campaign name, the total number of customers who received the offer, the number who converted, and the conversion percentage rounded to 2 decimal places. Sort the results by conversion percentage descending, then by campaign name.

Schema

pnc_offer_events
ColumnTypeDescription
offer_idPKINTUnique identifier for each offer event row
customer_idINTCustomer who received the offer
campaign_nameVARCHAR(100)PNC marketing campaign name
channelVARCHAR(50)Offer delivery channel
convertedBOOLEANWhether the customer converted after receiving the offer
offer_dateDATEDate the offer was sent
Tablespnc_offer_events
Your solutionPostgreSQL
You need to log in / sign up to run or submit.
Run a query to see results