Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

BigQuery `LIKE ANY` and `NOT LIKE ANY`

Try to understand the BigQuery behaviour of the ANY operator (see also here

The following statement returns as expected true:

SELECT 'a'      LIKE ANY ('b','%b%', 'b', 'a');
--true

It basically answers the question, is there any ‘a’ in the pattern, yes it is!

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Now inverting the statement also returns true:

SELECT 'a'  NOT LIKE ANY ('b','%b%', 'b', 'a');
-- true

In this case the question would be is there not any ‘a’ in the pattern, which is false, there is a ‘a’ in the pattern.

Can somebody help me to understand the behaviour of BigQuery? thanks!

Was reading throw the documentation which states: ANY: Checks if the set of patterns contains at least one pattern that matches the search value

>Solution :

No, the second query asks the database if in the tupel are elements that are not a

And as there are 3 You get true.

For what you are searching is NOT IN

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading