Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google BigQuery case insensitive match

How would I run the following query, like I would again mysql:

SELECT * FROM [integrated-myth-15.testing_data_100k]
WHERE title='down in la'

Now it will match if I have a perfect case-sensitive string match, but how would I do it case insensitive for "down in la"? I'm working from the Web console.

like image 914
David542 Avatar asked Jun 13 '17 00:06

David542


People also ask

Is BigQuery case insensitive?

I was stunned when some of my BigQuery queries were taking a minute or so, instead of the usual few seconds. The culprit: Case insensitive searches.

Is BigQuery like case sensitive?

Case Sensitivity - Unlike most RDBMS, BigQuery is case sensitive, not only for string comparison, but for object names as well.

How can I remove special characters from a string in BigQuery?

If you want to remove a specific character from your String then you can use the Trimming function to do so. Based on the position of the character that you wish to remove there are three kinds of BigQuery String Functions: TRIM (value1[, value2]): It removes all the leading and trailing characters that match value2.

How do you handle NULL values in BigQuery?

The COALESCE function in BigQuery will return the first non-NULL expression. It's often used to safely handle NULL values.


1 Answers

The standard way to do this is using LOWER or UPPER on the input string, e.g.:

#legacySQL
SELECT * FROM [integrated-myth-15.testing_data_100k]
WHERE LOWER(title) = 'down in la';

Or:

#standardSQL
SELECT * FROM `integrated-myth-15.testing_data_100k`
WHERE LOWER(title) = 'down in la';
like image 50
Elliott Brossard Avatar answered Oct 08 '22 18:10

Elliott Brossard