About the “Ad Campaign Attribution & ROI” SQL Problem
Business Scenario
The performance marketing director needs an attribution report connecting advertising spend to confirmed closed-won revenue from the CRM deals table.
Expected Output & Criteria
Campaign performance metrics with campaign_name, channel, budget_spent, revenue_generated, and roas.
Database Table Schema (PostgreSQL DDL)
PostgreSQL 16 WASMThis challenge executes directly against the following relational schema in your browser:
CREATE TABLE ad_campaigns (
campaign_id INT PRIMARY KEY,
campaign_name VARCHAR(100) NOT NULL,
channel VARCHAR(50) NOT NULL,
budget_spent NUMERIC(10, 2) NOT NULL
);
CREATE TABLE deals (
deal_id INT PRIMARY KEY,
campaign_id INT REFERENCES ad_campaigns(campaign_id),
deal_status VARCHAR(30) NOT NULL,
deal_value NUMERIC(10, 2) NOT NULL
);Target SQL Clauses & Operators
JOINGROUP BYSUMROUND
Want more Joins practice?
Explore the full syllabus of 12 exercises, syntax guides, and interview pitfalls.