Marketing Analytics Path · Mission 6 of 25Easy

Count unique customers

Use COUNT(DISTINCT) to find unique customers

Back to Marketing Analytics

The Brief

Sarah KimVP of Marketingmarketing-analytics

Quick one — how many unique customers do we actually have in the database? I keep hearing different numbers from different teams and I want one source of truth before the board meeting.

You'll practice

COUNT DISTINCTAmbiguity

Tables available

dim_customers

Hints (3)

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

Hint 1

Use `COUNT(DISTINCT customer_id)` on `dim_customers` instead of `COUNT(*)` — DISTINCT ensures each ID is counted once

Hint 2

You can alias it: `SELECT COUNT(DISTINCT customer_id) AS total_customers FROM dim_customers`

Hint 3

The result should be a single row with one number. If you're getting multiple rows, remove any GROUP BY