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 the CASE WHEN statement in Google Big Query?
- How do I rename a column in Google BigQuery?
- ¿Cuáles son las ventajas y desventajas de usar Google BigQuery?
- What are the advantages and disadvantages of using Google BigQuery?
- How can I use Google BigQuery to analyze Bitcoin data?
- How do I use the YEAR function in Google BigQuery?
- How do I use wildcards in Google BigQuery?
- How can I get started with Google BigQuery training?
- How do I use Google BigQuery Sandbox?
- How can I use Google Big Query to process XML data?
See more codes...