Back to questions

Marketing Touch Streak Snowflake SQL Interview Question

Marketing Touch Streak

Snowflake SQL Interview Question

As a Data Analyst on Snowflake's Marketing Analytics team, your objective is to analyze customer relationship management (CRM) data and identify contacts that satisfy two conditions:

  1. Contacts who had a marketing touch for three or more consecutive weeks.
  2. Contacts who had at least one marketing touch of the type 'trial_request'.

Marketing touches, also known as touch points, represent the interactions or points of contact between a brand and its customers.

Your goal is to generate a list of email addresses for these contacts.

Table:

Column NameType
event_idinteger
contact_idinteger
event_typestring ('webinar', 'conference_registration', 'trial_request')
event_datedate

Example Input:

event_idcontact_idevent_typeevent_date
11webinar4/17/2022
21trial_request4/23/2022
31whitepaper_download4/30/2022
42handson_lab4/19/2022
52trial_request4/23/2022
62conference_registration4/24/2022
73whitepaper_download4/30/2022
84trial_request4/30/2022
94webinar5/14/2022

Table:

Column NameType
contact_idinteger
emailstring

Example Input:

Example Output:

Explanation:

Among the contacts, only Contact ID 1 (andy.markus@att.net) satisfies both conditions specified in the problem. Contact ID 1 had a marketing touch with an event type of 'trial_request' and the marketing touch points occurred consecutively over a period of 3 weeks. This meets both conditions of having a marketing touch for three or more consecutive weeks.

On the other hand, Contact ID 2 (rajan.bhatt@capitalone.com) is not included in the generated list. Although they had a marketing touch with the event type 'trial_request', their touch points took place within the same week. Consequently, this does not meet the requirement of consecutive marketing touches for 3 weeks.

The dataset you are querying against may have different input & output - this is just an example!

Input

Output