Last active
March 10, 2016 21:31
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| https://bigquery.cloud.google.com/queries/hacker-news-analytics?pli=1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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