Skip to content

Country Code

Type Registry

Country Code

geography.location.country_code

ISO 3166-1 alpha-2 country code (2 letters, e.g., US, FR, JP). Universal format.

Domain geographylocation
Casts to VARCHAR
Scope Universal

Try it

CLI
$ finetype infer -i "US"
→ geography.location.country_code

DuckDB

Detect
SELECT finetype('US');
-- → 'geography.location.country_code'
Cast expression
UPPER(CAST({col} AS VARCHAR))
Safe cast pipeline
-- Normalise and cast in one step
SELECT TRY_CAST(finetype_cast(my_column) AS VARCHAR) AS clean_value
FROM my_table
WHERE finetype(my_column) = 'geography.location.country_code';

JSON Schema

finetype schema geography.location.country_code
{
  "$id": "https://noon.sh/schemas/geography.location.country_code",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "description": "ISO 3166-1 alpha-2 country code (2 letters, e.g., US, FR, JP). Universal format.",
  "examples": [
    "US",
    "FR",
    "JP",
    "DE",
    "CA"
  ],
  "pattern": "^[A-Z]{2}$",
  "title": "Country Code",
  "type": "string"
}

Examples

USFRJPDECA

Also known as

iso_3166_1_alpha_2

Types in geography