From the course: Introduction to SQL Using Google BigQuery

Unlock this course with a free trial

Join today to access over 25,300 courses taught by industry experts.

Fuzzy string matching

Fuzzy string matching

- [Instructor] The WHERE clause is very useful when we want to look at exact matches. But did you know that we can also use it to perform partial or fuzzy matching with string data type columns? We can use the SQL LIKE operator in BigQuery to find matches in string data which contain a specific pattern in a record value. For example, let's say we wish to find all the records in our products table where the word Dog appears in the product_name field. We can use a WHERE clause and the LIKE operator to perform a fuzzy string match. The percentage sign characters in this query that surrounds Dog are called wildcards. These characters let BigQuery know that we only care if the word Dog appears in a string value. If I were to remove the percentage sign before the Dog, but kept the one after, I'm asking BigQuery to only give me matches where Dog appears at the beginning of the product_name column. On the other hand, if I…

Contents