How do I count distinct country values with SQL?
SELECT COUNT(DISTINCT country) AS unique_country FROM data;
Run this query in QueryLocal →
`COUNT(DISTINCT country)` counts how many different country values appear across the table, ignoring how many rows repeat each one — different from `COUNT(*)`, which would count every row regardless of repetition.
A table named data with columns: order_id (integer), customer (text), country (text), category (text), quantity (integer), unit_price (real), order_date (text, YYYY-MM-DD).