DISTINCT: Unique Customer Countries

Basics
BasicsDISTINCTORDER BYGoogleAmazonMeta

Table

  • customers(customer_id INT, country VARCHAR)

Task

From customers(customer_id, country), return every unique non-null country sorted alphabetically.

Why It Matters: SELECT DISTINCT eliminates duplicate dimension values when building dropdowns, regional rollups, or unique-entity counts.

Output columns: country

Example

Input — customers

customer_idcountry
1US
2IN
3US
4DE

Expected Output

country
DE
IN
US

Explanation: Duplicate country values collapse into one row per unique country, sorted alphabetically.

Requirements

  • Exact output columns: country
  • Row order: Exact ORDER BY order is checked by the grader.
  • Query type: Write a single read-only Standard SQL SELECT (or WITH ... SELECT) query.

Constraints & Evaluation Criteria

  • Return a single column `country` sorted alphabetically.

Hints

SQL
Loading Code Editor...
+1 Hidden Submit Case
Input / Scenario
customers (4 rows)
Expected Output / Criteria
3 row(s): (DE); (IN); (US)