E-commerce & Retail Analytics Path · Mission 3 of 30Starter

Customers by country

Use GROUP BY with COUNT to roll up customer headcount by region. The two-column 'pivot table' that every executive review starts with — sized appropriately for a board-deck snapshot of where the customer base lives.

The Brief

Mira CastellanosHead of Growthecom-ops

Board prep ask. Roll up the customer file by country. I want one row per country with the customer count, ordered by count descending so I can paste it straight into the deck. Use `ecom_customers`. The CEO wants to know how concentrated US-vs-international actually is — we keep saying 'we're a US brand' and I'm not sure that's still true.

You'll practice

GROUP BYCOUNTJOIN

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

GROUP BY collapses rows that share a value. You want one row per country with a count alongside.

Hint 2

`SELECT country, COUNT(*) AS customer_count FROM ecom_customers GROUP BY country ORDER BY customer_count DESC` is the shape.

Hint 3

You should see eleven rows. US is the biggest by a wide margin; the long tail is European and Japanese customers.