UPPER(string) returns the string in upper case: Café Nord becomes CAFÉ NORD. DuckDB's upper() matches. When UPPER is there to merge East and east, keep it in the SQL's DISTINCT or GROUP BY: DuckDB compares case sensitively.
Updated · Checked on the xmetric engine
What is the syntax?
UPPER(string)
string
the text.
Returns the string in upper case. Null if the string is null.
What does it return, and what is the SQL?
Each example runs on the same 7 sample rows twice: the Tableau formula on the xmetric engine, and the SQL in DuckDB.
What does each name look like in capitals?
Tableau
UPPER([Name])
SQL (DuckDB)
SELECTupper(Name) AS result
FROM input
ORDERBY id
mary-jo o'neil becomes MARY-JO O'NEIL.
Name
Result
Ann Lee
ANN LEE
bob ray
BOB RAY
Café Nord
CAFÉ NORD
east
EAST
East
EAST
mary-jo o'neil
MARY-JO O'NEIL
null
✓ The Tableau formula and the SQL return the same 7 rows.
Where does a straight translation go wrong?
Common mistake
Why does the SQL count East and east separately?
DuckDB's DISTINCT is case sensitive. COUNTD(UPPER([Name])) merges the two spellings; dropping UPPER in the SQL counts 6 names, not 5.
Tableau
COUNTD(UPPER([Name]))
Tempting SQL
SELECTcount(DISTINCT Name) AS result
FROM input
SQL that matches
SELECTcount(DISTINCTupper(Name)) AS result
FROM input
Tableau
Tempting SQL
SQL that matches
5
6
5
✓ The SQL that matches returns the Tableau result on every row; the marked cells are where the tempting SQL differs.
How do I write it in Snowflake or BigQuery?
The first example, written for each warehouse from its documentation. These are not run here; DuckDB is.