I need to capitalize a string:
john doe -> John Doe
How to do this?
I suppose need to use NORMALIZE_AND_CASEFOLD, but it returns a lower case.
NORMALIZE_AND_CASEFOLD
NORMALIZE_AND_CASEFOLD(value[, normalization_mode]) Description
Takes a STRING, value, and performs the same actions as NORMALIZE, as well as casefolding for case-insensitive operations.
NORMALIZE_AND_CASEFOLD supports four optional normalization modes:
Value Name Description NFC Normalization Form Canonical Composition Decomposes and recomposes characters by canonical equivalence. NFKC Normalization Form Compatibility Composition Decomposes characters by compatibility, then recomposes them by canonical equivalence. NFD Normalization Form Canonical Decomposition Decomposes characters by canonical equivalence, and multiple combining characters are arranged in a specific order. NFKD Normalization Form Compatibility Decomposition Decomposes characters by compatibility, and multiple combining characters are arranged in a specific order.
Below is for BigQuery Standard SQL and with use of JS UDF (first query) and SQL UDF (second one)
or
you can test above with dummy data as
with result for both options:
Maybe that is a little bit more complex than the easier way...
CONCAT( UPPER( SUBSTR( field,1,1 ) ), SUBSTR( Bets.status_code,2,CHAR_LENGTH(field) ) ) as CapitalizedField