Skip to content

Instantly share code, notes, and snippets.

@mstump
Last active March 10, 2016 21:31
Show Gist options
  • Select an option

  • Save mstump/26ed7548524fa17bbdc8 to your computer and use it in GitHub Desktop.

Select an option

Save mstump/26ed7548524fa17bbdc8 to your computer and use it in GitHub Desktop.
google big table query to get most popular domains submitted to hacker news
https://bigquery.cloud.google.com/queries/hacker-news-analytics?pli=1
SELECT
user_domain,
COUNT(*) AS activity_count
FROM (
SELECT
DOMAIN(url) AS user_domain,
year
FROM (
SELECT
url,
INTEGER(time / (60*60*24*365)) + 1970 AS year
FROM
[fh-bigquery:hackernews.stories] )
WHERE
year = 2015)
GROUP BY
user_domain
HAVING
user_domain IS NOT NULL
AND user_domain != ''
ORDER BY
activity_count DESC
LIMIT
1000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment