igrigorik/githubarchive.org — pull request #24 by izuzak (2013-01-12 09:19:33+00:00)
Title: Add two more BigQuery examples for calculating useful statistics

Hi Ilya,

I really like the BigQuery examples in the README, they've been very helpful when I started playing with githubarchive in BigQuery. I've added two new examples that I've found people often need but have trouble with writing them themselves:

1) Fetching the top N repos by fork/watches count for a specific date range. This query orders the repos not by the number of forks that happened in that range, but rather by the maximum total number of forks that the repository had in that range.

2) Fetching the month-by-month number of events (by type) for a specific repository/language. This is really cool since it allows people to get timeline statistics with just a single query. The query is easily modified to do a day-by-day count by using `LEFT(created_at, 10)` instead of `LEFT(created_at, 7)`.