An analysis was conducted on the top three European countries whose companies generate the highest revenue. Data sourse https://www.kaggle.com/datasets/harshgupta4444/list-of-largest-companies-in-world?select=Europe.csv
WITH rev_by_couind AS (
SELECT Headquarters, Industry, SUM("Revenue(US$ billions)") AS revenue_sum
FROM Europe.csv
GROUP BY Headquarters, Industry),
rev_whole_counry AS (SELECT Headquarters, Industry, revenue_sum, SUM(revenue_sum) OVER (PARTITION BY Headquarters) AS revenue_by_country
FROM rev_by_couind
ORDER BY revenue_sum DESC),
ranked_countries AS(SELECT *, DENSE_RANK() OVER(ORDER BY revenue_by_country DESC) AS top_countries_by_revenue
FROM rev_whole_counry
ORDER BY top_countries_by_revenue)
SELECT *, revenue_sum/revenue_by_country *100 AS perc_industry_by_country
FROM ranked_countries
WHERE top_countries_by_revenue <=3
ORDER BY top_countries_by_revenue, perc_industry_by_country DESC
import matplotlib.pyplot as plt
fig, ax = plt.subplots()
ax.bar(all_countries_data['Headquarters'], all_countries_data['revenue_by_country'])
ax.set_title('Revenue by country')
plt.show()Germany receives the largest revenue among all European countries, totaling 2,278.322 billion USD. In second place among European countries by total revenue is France. It recieves revenue from companies totaling almoust 1,800 billion USD. The Top 3 Eurorean countries by company revenue is concluded by the United Kingdom (1,142 billion USD).
SELECT *
FROM all_countries_data
WHERE Headquarters = 'Germany'
ORDER BY perc_industry_by_country DESCimport matplotlib.pyplot as plt
fig, ax = plt.subplots()
ax.barh(germany['Industry'], germany['perc_industry_by_country'])
ax.invert_yaxis()
plt.title('Revenue Distribution (Germany)')
ax.set_xlabel('Percentage')
ax.set_ylabel('Industry')
plt.show()The most developed sector in Germany is the Automotive industry. It brings the country 32.6% of the total revenue, amounting to 743,367 billion USD. In second place, we see Financial services, accounting for 14.8% of the country's total revenue, which is 337,6 billion USD. Other developing sectors in Germany include Electric Utilities (9.6% of total country revenue), Conglomerate (9.3%), Telecommunications (7.4%), and Retail (6.4%).
SELECT *
FROM "Europe.csv"
WHERE Headquarters = 'Germany' AND Industry = 'Automotive'import matplotlib.pyplot as plt
fig, ax = plt.subplots()
ax.pie(germ_top1['Revenue(US$ billions)'], labels = germ_top1['Company'])
ax.set_title('Automotive in Germany (top 1)')
plt.show()
The largest automotive company in Germany is Volkswagen, which earns 348.4 billion USD, representing 47% of the entire sector. This is why Volkswagen is a powerful giant in the German automotive sector. BMW accounts for 23% (168.9 billion USD) and Mercedes-Benz Group accounts for 22% (165.6 billion USD).
SELECT *
FROM "Europe.csv"
WHERE Headquarters = 'Germany' AND Industry = 'Financial services'import matplotlib.pyplot as plt
fig, ax = plt.subplots()
ax.pie(germ_top2['Revenue(US$ billions)'], labels = germ_top2['Company'])
ax.set_title('Financial services in Germany (top 2)')
plt.show()The largest financial company in Germany is Allianz, which commands 34% of the sector's revenue, generating 113.5 billion USD. Deutsche Bank 66 billions USD (19.5% of total country revenue), and Munich Re 63.3 billion USD (19%).
SELECT *
FROM all_countries_data
WHERE Headquarters = 'France'
ORDER BY perc_industry_by_country DESCimport matplotlib.pyplot as plt
fig, ax = plt.subplots()
ax.barh(france['Industry'], france['perc_industry_by_country'])
ax.invert_yaxis()
plt.title('Revenue Distribution (France)')
ax.set_xlabel('Percentage')
ax.set_ylabel('Industry')
plt.show()