Skip to main content

Marketing Campaign Duration

Easy

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
integerstringinteger

transaction table

transaction_iduser_idproduct_idtransaction_datequantity
integerintegerintegertimestampinteger

Write a SQL query that calculates the average duration of campaigns.