Project 13: Analyzing Unicorn Companies

Did you know that the average return from investing in stocks is 10% yearly! But who wants to be average?!

You have been asked to support an investment firm by analyzing trends in high-growth companies. They are interested in understanding which industries produce the highest valuations and the rate at which new high-value companies emerge. Providing this information gives them a competitive insight into industry trends and how they should structure their portfolio looking forward.

You have been given access to their unicorns database, which contains the following tables:

dates

ColumnDescription
company_idA unique ID for the company.
date_joinedThe date that the company became a unicorn.
year_foundedThe year that the company was founded.

funding

ColumnDescription
company_idA unique ID for the company.
valuationCompany value in US dollars.
fundingThe amount of funding raised in US dollars.
select_investorsA list of key investors in the company.

industries

ColumnDescription
company_idA unique ID for the company.
industryThe industry that the company operates in.

companies

ColumnDescription
company_idA unique ID for the company.
companyThe name of the company.
cityThe city where the company is headquartered.
countryThe country where the company is headquartered.
continentThe continent where the company is headquartered.

Solution Plan

The initial task is to identify the three best-performing industries based on the number of new unicorns created over the last three years (2019, 2020, and 2021) combined.

From there, I will write a query to return the industry, the year, the number of companies in these industries that became unicorns each year in 2019, 2020, and 2021, along with the average valuation per industry per year, converted to billions of dollars and rounded to two decimal places!

As the firm is interested in trends for the top-performing industries, your results should be displayed by industry, then year in descending order.

In [12]:

WITH top_3 AS (SELECT industry, COUNT(company) AS num_unicorn FROM dates
LEFT JOIN companies
USING(company_id)
LEFT JOIN industries
USING(company_id)
WHERE to_char(date_joined,'YYYY') IN ('2019','2020','2021') 
GROUP BY industry 
ORDER BY num_unicorn DESC
LIMIT 3)

SELECT industry, 
CASE WHEN to_char(date_joined, 'YYYY') = '2019' THEN 2019
	 WHEN to_char(date_joined, 'YYYY') = '2020' THEN 2020
     WHEN to_char(date_joined, 'YYYY') = '2021' THEN 2021
     END AS year,
     COUNT(company) AS num_unicorns, ROUND(AVG(valuation)/1000000000,2)  AS average_valuation_billions
FROM dates
INNER JOIN funding
USING(company_id)
INNER JOIN industries
USING(company_id)
INNER JOIN companies
USING(company_id)

WHERE industry IN (SELECT industry FROM top_3) AND (to_char(date_joined,'YYYY') IN ('2019','2020','2021') )
GROUP BY industry, year
ORDER BY industry, year DESC;

Out[12]:

industryyearnum_unicornsaverage_valuation_billions
0E-commerce & direct-to-consumer2021472.47
1E-commerce & direct-to-consumer2020164.00
2E-commerce & direct-to-consumer2019122.58
3Fintech20211382.75
4Fintech2020154.33
5Fintech2019206.80
6Internet software & services20211192.15
7Internet software & services2020204.35
8Internet software & services2019134.23

Leave a comment