Practice · Industry · Medium
From investment_deals, return each category and the total value_usd_bn for that category as total_bn, largest total first.
Runs in your browser. No signup needed.
investment_deals(name, year, value_usd_bn, category). Use SUM + GROUP BY.
SELECT category, SUM(value_usd_bn) AS total_bn
FROM investment_deals
GROUP BY category
ORDER BY total_bn DESC;
The reference solution is checked automatically when you run your query on the practice page — results are compared row by row, and order matters for this one.
The 2024 Ras El Hekma deal ($35bn from a UAE/ADQ consortium) is the largest single foreign investment in Egypt’s history. (Bloomberg)