Back to problems

Compute CTR overall and by campaign type

SQL · Meta · Medium

You are given two tables that record advertising activity and campaign metadata respectively. ad_event_log holds one row for every logged ad interaction: ad_id INT campaign_id INT event_type STRING — either 'impression' or 'click' view_key STRING logged_at TIMESTAMP — UTC campaign_dim maps campaigns to their category: campaign_id INT campaign_type STRING — either 'direct_response' or 'brand' Treat the current date as 2025-09-01. The reporting period is "last week", meaning…

Checking your access…