DataDriven
LearnPracticeInterviewDiscussDailyJobs

The Conversion Story

A medium SQL interview practice problem on DataDriven. Write and execute real sql code with instant grading.

Domain
SQL
Difficulty
medium
Seniority
L5

Problem

From the event_data table, calculate each referral source's conversion rate from signup to paid purchase. Derive the referral source from the event's tags: classify a row as 'organic' if its tags contain "organic", else 'referral' if it contains "referral", else 'campaign_a' if it contains "campaign_a", else 'campaign_b' if it contains "campaign_b", else 'other'. For each source, the conversion rate is the number of distinct users with a purchase event divided by the number of distinct users with a signup event. Only include sources that have at least one signup. Round the rate to 4 decimal places.

Summary

Signups are one thing. Paid purchases are another. Find the gap by source.

Practice This Problem

Solve this SQL problem with real code execution. DataDriven runs your SQL queries against a real database and grades it automatically.

Related

  • All Practice Problems
  • Mock Interview Mode
  • SQL Interview Questions
  • Data Engineering Interview Prep Guide
  • Daily Challenge
  • Data Engineering Lessons