This is a collection of interesting queries that can be run on http://commonwealth.io/~crunchbase. Each query is shown in full with a corresponding HTTP link. These queries can also be run on the native PostgreSQL interface, described more at http://commonwealth.io/about/postgres.
Last active
August 29, 2015 13:57
-
-
Save bakks/9421513 to your computer and use it in GitHub Desktop.
Interesting Crunchbase Queries
This file contains 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
-- Funding dollars and rounds per month since 2000 | |
-- http://commonwealth.io/api/v1/postgres?query=select%20funded_year,%20funded_month,%20sum(raised_amount)%20raised,%20count(*)%20funding_rounds%20from%20crunchbase.funding%20where%20funded_year%20%3E=%202000%20and%20raised_amount%20is%20not%20null%20and%20funded_year%20is%20not%20null%20and%20funded_month%20is%20not%20null%20group%20by%20funded_year,%20funded_month%20order%20by%20funded_year%20desc,%20funded_month%20desc%20limit%201000; | |
select funded_year, funded_month, | |
sum(raised_amount) raised, count(*) funding_rounds | |
from crunchbase.funding | |
where funded_year >= 2000 | |
and raised_amount is not null | |
and funded_year is not null | |
and funded_month is not null | |
group by funded_year, funded_month | |
order by funded_year desc, funded_month desc | |
limit 1000; |
This file contains 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
-- Show the most active individual/Angel investors in the past year, ordered by number of deals. | |
-- http://commonwealth.io/api/v1/postgres?query=select%20person_id%2C%20count(*)%20num_deals%0Afrom%20crunchbase.investments%20i%0Ainner%20join%20crunchbase.funding%20f%20on%20i.funding_id%20%3D%20f.id%0Awhere%20person_id%20is%20not%20null%0A%20and%20funded_month%20is%20not%20null%0A%20and%20(now()%20-%20format(%27%25s-%25s-%25s%27%2C%20funded_year%2C%20funded_month%2C%20coalesce(funded_day%2C%201))%3A%3Adate)%20%3C%3D%20interval%20%27365%20days%27%0Agroup%20by%20person_id%0Aorder%20by%20num_deals%20desc%0Alimit%2050%3B | |
select person_id, count(*) num_deals | |
from crunchbase.investments i | |
inner join crunchbase.funding f on i.funding_id = f.id | |
where person_id is not null | |
and funded_month is not null | |
and (now() - format('%s-%s-%s', funded_year, funded_month, coalesce(funded_day, 1))::date) <= interval '365 days' | |
group by person_id | |
order by num_deals desc | |
limit 50; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment