This SQL portfolio project analyzes the world's 2000 largest global companies, as published by Forbes and sourced from Kaggle: Kaggle Dataset. The dataset was cleaned, encoded in UTF-8, and restructured for compatibility with PostgreSQL, including proper typing for numeric and date fields.
The project answers 21 business-focused SQL questions using PostgreSQL. It demonstrates proficiency in:
- CTEs (Common Table Expressions)
- Subqueries and nested logic
- Window Functions (
RANK()
,ROW_NUMBER()
,LAG()
,SUM(...) OVER
) - Self-joins and conditional joins
- Views for reusability and dashboard reporting
All queries were executed in pgAdmin 4 and structured for clarity and performance.
CREATE TABLE largest_companies (
rank INTEGER,
name TEXT,
sales NUMERIC, -- in billions
profit NUMERIC, -- in billions
assets NUMERIC, -- in billions
market_value NUMERIC, -- in billions
industry TEXT,
founded INTEGER,
headquarters TEXT,
country TEXT,
ceo TEXT,
employees NUMERIC
);
- Saudi Aramco, Apple, and Microsoft lead the list, each with over $85B in profit.
- Global average: 48,583 employees per company.
- Includes Wells Fargo (1852), Chevron (1879), Johnson & Johnson (1886), among others.
- Top entries include Bank of America, China Construction Bank, TD Bank Group.
- Banking and Financial Services dominates with over $77,412B in total assets.
- USA: 621, China: 282, Japan: 181, India: 70.
- Top: Semiconductors ($202B), IT Software & Services ($143B), Packaged Goods ($142B).
- USA: $1,767B, China: $629B, Japan: $280B.
- To identify company pairs in the same country but different industries.
- Used to calculate average sales and average assets by group.
RANK()
to find top 3 companies by profit per country.ROW_NUMBER()
to get the alphabetically first company per country.LAG()
to compare profit to previous company by industry.SUM(...) OVER
for running total of market value by country.
dashboard
: summarized company metrics for BI tools.top_5
: top 5 companies by sales in each industry.
- PostgreSQL (v15+)
- pgAdmin
- CSV pre-processing (encoding fixes, column normalization)
- Data visualization ( Power BI )
Purpose
A polished, multi-page Power BI layer that turns the PostgreSQL outputs into board-ready insights with ranked KPIs, %-of-global context, and clean, consistent visuals.
- Snapshot — Headline KPIs, Top-N companies by composite rank, quick compare cards.
- Geography — Country totals with bar/line views and a % of global overlay; optional choropleth.
- Sector/Industry — Leaders by industry, treemap/bars, rank and share views.
- Company — Profile with overall rank card and a compact 3-spoke radar (Sales | Profit | Market Value) using normalized metrics.
- Independent ranks for Sales, Profit, Assets, and Market Value.
- Composite ranking by summing pillar ranks (lower = better).
- % of global KPIs for country/industry context.
- Min–max normalization for comparable radar spokes.
- Assets formatted in trillions for executive readability.
- Searchable slicers; single-select where appropriate.
- Top-Performers bookmark for instant leader views.
- Concise labels, informative tooltips, consistent number formats.
- Professional dark theme with high-contrast text and restrained accents.
- Measure dictionary (business names, definitions, notes).
- Data model diagram (tables, relationships, grain).
- Short usage guide (refresh steps, slicer behavior, export tips).
- Optional one-page KPI glossary.
- Open the PBIX, point sources to your PostgreSQL views (or CSVs), and refresh.
- Validate a few spot-check totals against your source numbers.
- Use bookmarks and slicers to navigate leaders, countries, and industries.
You can interact with the dashboard here: https://app.powerbi.com/links/0h0JQGy9gk?ctid=eaf624c8-a0c4-4195-87d2-443e5d7516cd&pbi_source=linkShare
Ahmed Elsayed Abdelmawla Elsayed a7madv4d2@gmail.com LinkedIn | GitHub
Apache 2.0.