Skip to main content
All Questions

Find Campaign Purchases

Medium
Unlock detailed company stats for this questionUpgrade

You are given 3 tables, campaign, user and transaction with the following columns

campaign table:

upsell_campaign_iddate_startdate_end
integertimestamptimestamp

user table:

user_idnameis_eligible_for_upsell_campaign
integerstringboolean

transaction table

transaction_iduser_idproduct_idtransaction_datequantity
integerintegerintegertimestampinteger

Write a SQL query that lists out the number of users for each campaign who were eligible for an upsell and purchased something.

Related courses

Course

Data Analyst Interview Prep

Ace your data analyst interviews—whether you're targeting product, marketing, or business analyst roles. Tackle real take-home case studies, sharpen your technical and dashboarding skills, and get strategies from interviewers at top tech companies and startups.

Course

Data Science Interview Prep

Land your dream data science role at Google, Amazon, Microsoft, Meta, Apple, and other top companies. Learn from mock interviews, frameworks, and advice from senior candidates. Practice statistics, experimentation, coding, SQL, machine learning, behavioral interviews, and more.