Skip to content
Advertisement

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?

Advertisement

Answer

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'

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement