Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Flag Incomplete Campaign Tracking

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

Your question is Flag Incomplete Campaign Tracking. Start with the requirements and the three tables 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 campaign delivery, web session, and conversion data for a multi-channel digital campaign. Write a PostgreSQL query that returns one row per Arthur J. Gallagher campaign and channel for January 2024, showing delivered clicks, tracked sessions, tracked conversions, session tracking rate, conversion tracking rate, and a data quality flag. Treat missing downstream tracking as zero, and classify each row as complete, partial, or missing based on whether sessions and conversions are present relative to delivered clicks.

Use the campaign delivery table as the base so channels with clicks but no tracked sessions or conversions still appear in the output.

Schema

campaign_delivery
ColumnTypeDescription
delivery_idPKINTUnique delivery record
campaign_idINTCampaign identifier
channelVARCHAR(50)Marketing channel
delivery_dateDATEDate clicks were delivered
impressionsINTImpressions served
clicksINTClicks delivered
web_sessions
ColumnTypeDescription
session_idPKINTUnique session record
campaign_idINTCampaign identifier
channelVARCHAR(50)Attributed marketing channel
session_dateDATEDate of tracked session
tracked_sessionsINTTracked session count
conversions
ColumnTypeDescription
conversion_idPKINTUnique conversion record
campaign_idINTCampaign identifier
channelVARCHAR(50)Attributed marketing channel
conversion_dateDATEDate of tracked conversion
tracked_conversionsINTTracked conversion count
Tablescampaign_deliveryweb_sessionsconversions
Your solutionPostgreSQL
You need to log in / sign up to run or submit.
Run a query to see results