Skip to content

Instantly share code, notes, and snippets.

@mbforr
Last active January 8, 2023 11:27
Show Gist options
  • Save mbforr/cf90661491dec50e7670c7b526a431c4 to your computer and use it in GitHub Desktop.
Save mbforr/cf90661491dec50e7670c7b526a431c4 to your computer and use it in GitHub Desktop.
select
state_geom, state_name, state
from
`bigquery-public-data.geo_us_boundaries.states`
# this time we will use the LEFT() function to find states where the first letter = M
# this function takes a string and a number as arguments
# in this case it takes the state_name column and 1
# meaning we get the first leftmost letter returned from every column in the dataset
# https://cloud.google.com/bigquery/docs/reference/standard-sql/string_functions#left
where left(state_name, 1) = 'M'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment