Skip to content

Instantly share code, notes, and snippets.

@zitterbewegung
Last active January 24, 2017 17:32
Show Gist options
  • Select an option

  • Save zitterbewegung/85744c754fc295d7c8e2c57cfb219563 to your computer and use it in GitHub Desktop.

Select an option

Save zitterbewegung/85744c754fc295d7c8e2c57cfb219563 to your computer and use it in GitHub Desktop.
Computes the average amount of points of comments per month.
SELECT
CONCAT(STRING(YEAR(time_ts)),'-',RIGHT(STRING(100 + MONTH(time_ts)), 2)) AS Month,
AVG(ranking) AS rank,
EXACT_COUNT_DISTINCT([by]) AS CommentSum,
AVG(ranking) / EXACT_COUNT_DISTINCT([by]) AS PerCapita
FROM
[bigquery-public-data:hacker_news.comments]
GROUP BY
1
ORDER BY
1;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment