About this problem
The business question
Marketing is planning a re-engagement campaign for leads that never became paying accounts. Last time, the list came back empty and the campaign was cancelled, even though the sales team knew plenty of leads had gone quiet.
Expected result: Every lead with no matching account (no account whose source_lead_id equals the lead_id), with lead_id, company_name and source.
What you will practice
Tables
CREATE TABLE leads (
lead_id INT PRIMARY KEY,
company_name VARCHAR(100) NOT NULL,
source VARCHAR(30) NOT NULL,
created_at DATE NOT NULL
);
CREATE TABLE accounts (
account_id INT PRIMARY KEY,
company_name VARCHAR(100) NOT NULL,
source_lead_id INT REFERENCES leads(lead_id),
signed_at DATE NOT NULL
);More Joins practice
20 problems in this topic, with key concepts and common mistakes.