google-big-queryHow do I use Google BigQuery LIKE statements?
Google BigQuery provides the LIKE
statement to allow users to filter query results based on a pattern. The pattern is specified using wildcard characters _
and %
. The _
character matches any single character, while the %
character matches any sequence of characters.
For example, the following query uses the LIKE
statement to find all records with a name starting with John
:
SELECT *
FROM `my_table`
WHERE name LIKE 'John%'
This query will return all records from the my_table
table with a name that starts with John
.
The following query uses the LIKE
statement to find all records with a name ending with Smith
:
SELECT *
FROM `my_table`
WHERE name LIKE '%Smith'
This query will return all records from the my_table
table with a name that ends with Smith
.
The following query uses the LIKE
statement to find all records with a name containing John
:
SELECT *
FROM `my_table`
WHERE name LIKE '%John%'
This query will return all records from the my_table
table with a name that contains John
.
Helpful links
More of Google Big Query
- How can I use Google Big Query to count the number of zeros in a given dataset?
- How can I export data from Google Big Query to an XLSX file?
- How can I use Google Big Query to process XML data?
- How can I learn to use Google BigQuery?
- How do I use Google Big Query to zip files?
- ¿Cuáles son las ventajas y desventajas de usar Google BigQuery?
- How can I use the CASE WHEN statement in Google Big Query?
- How do I use the YEAR function in Google BigQuery?
- How do I query Google BigQuery using XML?
- How do I use Google Big Query with Excel?
See more codes...