sqlamazon-web-servicescaseamazon-athenapresto

Proper Case in Athena SQL


I'm new to Athena and trying to convert a field 'Country' to Proper Case. For example:

united states -> United States

Is there a way to do this in Athena?


Solution

  • Turning a comment into an answer:

    Athena engine version 2 gives in its RegEx section as example for
    regexp_replace(string, pattern, function)

    SELECT regexp_replace('new york', '(\w)(\w*)', x -> upper(x[1]) || lower(x[2])); --'New York'