Skip to content

Instantly share code, notes, and snippets.

@mbforr
Created July 6, 2021 19:38
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mbforr/ad8533763318bcc477c29656b1889f4c to your computer and use it in GitHub Desktop.
Save mbforr/ad8533763318bcc477c29656b1889f4c to your computer and use it in GitHub Desktop.
select
state_name,
st_area(state_geom) / 2.59e+6 as square_miles
from
`bigquery-public-data.geo_us_boundaries.states`
# we can order by any value in our table, or by a return value from a function
# we don't need to change it to square miles
# since we can just use square meters to order
# desc allows us to order by the area, in descending order
order by st_area(state_geom) desc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment