如何在Google Big Query中正确使用GROUP BY命令?

时间:2015-11-23 09:57:23

标签: sql bigdata google-bigquery

在尝试仅获取特定数据时遇到了一些问题。首先,我不知道如何创建一个SQL查询(当前的SQL查询我只能抓一个用户)所以我可以抓住这样的数据。

screenshot 2015-11-23 17 43 21

其次我想抓住1年的数据直到当前日期。下面是我到目前为止完成的sql查询(我需要逐个手动完成)。

SELECT type,  COUNT(*) FROM (
  TABLE_DATE_RANGE([githubarchive:day.events_], 
    TIMESTAMP('2013-1-01'), 
    TIMESTAMP('2015-08-28')
  )) AS events
WHERE type IN ("CommitCommentEvent","CreateEvent","DeleteEvent","DeploymentEvent","DeploymentStatusEvent","DownloadEvent","FollowEvent",
"ForkEvent","ForkApplyEvent","GistEvent","GollumEvent","IssueCommentEvent","IssuesEvent","MemberEvent","MembershipEvent","PageBuildEvent",
"PublicEvent","PullRequestEvent","PullRequestReviewCommentEvent","PushEvent","ReleaseEvent","RepositoryEvent","StatusEvent","TeamAddEvent",
"WatchEvent") AND actor.login = "datomnurdin"
GROUP BY type;

参考:

https://www.githubarchive.org/

https://github.com/igrigorik/githubarchive.org

0 个答案:

没有答案