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 export data from Google Big Query to an XLSX file?
- How do I sign in to Google Big Query?
- How do I set up a Google Big Query zone?
- How do I rename a column in Google BigQuery?
- ¿Cuáles son las ventajas y desventajas de usar Google BigQuery?
- How do I use the YEAR function in Google BigQuery?
- How do I use wildcards in Google BigQuery?
- How can I use Google BigQuery to retrieve data from a specific year?
- How do I start using Google Big Query?
- How can I use the CASE WHEN statement in Google Big Query?
See more codes...