Skip to content

Instantly share code, notes, and snippets.

@dannguyen
Created July 26, 2022 16:00
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save dannguyen/d34f9f2588e010a8f9e84fe03bdf0f01 to your computer and use it in GitHub Desktop.
Example of querying BigQuery's public dataset of SFPD crime incidents
SELECT
unique_key
, pddistrict AS pd_district
, DATE(timestamp) AS incident_date
, category
, descript AS description
, dayofweek AS day_of_week
, resolution
, UPPER(address) AS address
, longitude
, latitude
, timestamp AS incident_timestamp
, pdid AS pd_id
FROM
`bigquery-public-data.san_francisco.sfpd_incidents`
ORDER BY
incident_timestamp DESC
LIMIT
1000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment