How to do Case Insensitive Sorting (order by) in Google Bigquery

Bigquery is case-specific. There is no option / setting to make it to ignore case while sorting data in order by clause. Bigquery uses unicode value to order strings. 

The only option is to handle the case differences in the code by adding a UPPER() or NORMALIZE_AND_CASEFOLD function

Example:

SELECT * FROM dataset.tablename Order by NORMALIZE_AND_CASEFOLD(ColumnName);

OR

SELECT * FROM dataset.tablename Order by UPPER(ColumnName);

nVector

posted on 18 May 20

Enjoy great content like this and a lot more !

Signup for a free account to write a post / comment / upvote posts. Its simple and takes less than 5 seconds