Skip to content

Instantly share code, notes, and snippets.

@lacerogers20
Last active March 23, 2021 16:03
Show Gist options
  • Save lacerogers20/e8cde72185a31ecf3e1456ce4d5f800c to your computer and use it in GitHub Desktop.
Save lacerogers20/e8cde72185a31ecf3e1456ce4d5f800c to your computer and use it in GitHub Desktop.
create a simple BigQuery table if the table does not exist
CREATE TABLE IF NOT EXISTS `testing.insert` AS
(
SELECT
date,
COUNT(DISTINCT(visitid)) AS unique_visits
FROM
`bigquery-public-data.google_analytics_sample.ga_sessions_*`
WHERE
_table_suffix = '20170801'
GROUP BY
1) ;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment