E-commerce & Retail Analytics Path · Mission 8 of 30Easy

Repeat-customer rate

Compute a percentage from a CASE expression inside a SUM. The ratio pattern — repeat / total — that drives nearly every retention KPI in DTC.

The Brief

Mira CastellanosHead of Growthecom-ops

Board ask. Of customers who've ever ordered from us, what fraction have ordered MORE than once? That's the repeat-customer rate — repeat / total — and it's the single number the board cares about for the retention story. Use `ecom_customers`. Return one row, one column: `repeat_rate_pct`, rounded to one decimal place. We'll come back to repeat purchases by month in mission 18.

You'll practice

CASE aggregationRatio

Tables & columns available

ecom_customersdim9 columns
ColumnTypeKey
customer_idINTPK
emailTEXT
first_nameTEXT
last_nameTEXT
accepts_marketingINT
countryTEXT
created_dateTEXT
total_ordersINT
total_spentREAL

Hints (3)

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

Hint 1

Repeat = customers with `total_orders >= 2`. Total = customers with `total_orders >= 1` (everyone in our seed has ordered at least once, but the brief still says 'who've ever ordered' so the gate matters).

Hint 2

`SUM(CASE WHEN total_orders >= 2 THEN 1 ELSE 0 END)` is the repeat count; `SUM(CASE WHEN total_orders >= 1 THEN 1 ELSE 0 END)` is the denominator.

Hint 3

Expected: 32 / 50 = 64.0%. Use `100.0 *` to force float math, and `ROUND(..., 1)` for the one-decimal target.