Brightlane's growth team is building a regional marketing strategy and needs to identify which countries have registered customers.
Write a query to return each country represented in the customer base, with no duplicates.
Assumptions:
- The
customerstable contains every customer Brightlane has on file. - Many customers share the same country, so the raw
countrycolumn has heavy duplication.
Output:
- One row per distinct country, with a single column
country.
Schema · ecommerce 5 tables
Run previews · Check grades
Write a query, then run it to see results here.
Worked solution Try it yourself first
SELECT DISTINCT
country
FROM
customers The shape
DISTINCT on country collapses the heavily duplicated column down to its unique values — 22 rows out of however many thousand customers, one per country the growth team actually has presence in.
Clause by clause
SELECT DISTINCT countrynames the one column the dropdown needs and tells SQL to deduplicate the output. The keyword sits betweenSELECTand the column list; it applies to the whole row that comes back, not just tocountryin isolation. With only one column in the SELECT list, that distinction doesn't bite here, but it's the rule that matters as soon as a second column gets added.FROM customersis the row source — every customer Brightlane has on file. Each row contributes itscountryvalue to the candidate set, andDISTINCTruns across that set to produce the unique enumeration.
The result reads like a value space, not a customer list. Twenty-two rows, one per country represented in the base — US, GB, DE, and so on — which is exactly the input the regional marketing strategy needs.
You practiced collapsing a duplicated column down to its unique values with DISTINCT. The recurring shape: any time a single attribute repeats across many rows and the question is "what values exist," DISTINCT is the one-keyword answer.