Skip to content
Project - Analyzing Unicorn Companies
  • AI Chat
  • Code
  • Report
  • Did you know that the average return from investing in stocks is 10% per year! 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 are producing the highest valuations and the rate at which new high-value companies are emerging. Providing them with this information gives them a competitive insight as to 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.
    Spinner
    DataFrameavailable as
    top3_ind
    variable
    SELECT
    industry,
    count(distinct(dates.company_id)) as number_of_n_unicorns 
    FROM industries 
    LEFT JOIN dates on industries.company_id = dates.company_id where date_trunc('year',date_joined) in ('01-01-2019','01-01-2020','01-01-2021')
    group by 1 order by 2 DESC LIMIT 3
    Spinner
    DataFrameavailable as
    df
    variable
    SELECT 
    industry,
    date_trunc('year',date_joined) y,
    count(distinct(dates.company_id)) as num_unicorns,
    AVG(valuation) AS avg_valuation
    
    FROM industries 
    LEFT JOIN dates on industries.company_id = dates.company_id
    LEFT JOIN funding on industries.company_id = funding.company_id 
    WHERE
    date_trunc('year',date_joined) in ('01-01-2019','01-01-2020','01-01-2021') 
    AND 
    industry in('fintech','Internet software & services','E-commerce & direct-to-consumer')
    GROUP BY 1,2
    Spinner
    DataFrameavailable as
    df
    variable
    WITH raw_table AS
    (SELECT 
    industry,
    date_trunc('year',date_joined) y,
    count(distinct(dates.company_id)) as num_unicorns,
    AVG(valuation) AS avg_valuation
    
    FROM industries 
    LEFT JOIN dates on industries.company_id = dates.company_id
    LEFT JOIN funding on industries.company_id = funding.company_id 
    WHERE
    date_trunc('year',date_joined) in ('01-01-2019','01-01-2020','01-01-2021') 
    AND 
    industry in('fintech','Internet software & services','E-commerce & direct-to-consumer')
    GROUP BY 1,2)
    
    SELECT 
    industry,
    y,
    num_unicorns,
    ROUND((avg_valuation/1000),2) average_valuation_billions
    
    FROM raw_table
    group by 1,2,3,avg_valuation ORDER BY industry,y,average_valuation_billions DESC