Marketing Analytics Path · Mission 8 of 25Easy

How many customers never bought anything?

Use LEFT JOIN to find non-matching rows

Back to Marketing Analytics

The Brief

Sarah KimVP of Marketingmarketing-analytics

I want to know how many customers in our database have never made a purchase. Can you get me a count? This is for our re-engagement campaign targeting.

You'll practice

LEFT JOINIS NULL

Tables available

dim_customersfact_purchases

Hints (3)

Each hint you reveal reduces the XP you can earn. Try the query first.

Hint 1

Use a `LEFT JOIN` from `dim_customers` to `fact_purchases` on `customer_id` — this keeps all customers, even those with no purchases

Hint 2

After the LEFT JOIN, customers with no purchases will have NULL in the fact_purchases columns. Filter with `WHERE p.purchase_id IS NULL`

Hint 3

Count what's left: `SELECT COUNT(*) AS never_purchased`