Q&A 2 How do I compare GDP trends across EAC countries and the USA?
2.1 Explanation
A line chart makes it easy to compare the GDP growth of multiple countries over time. Since GDP is measured in current US$, the USA’s scale will dwarf EAC economies — but this highlights the contrast in economic size.
⸻
2.2 SQL Approach
If you have this dataset loaded into MySQL (table: gdp_data), you can query Kenya’s GDP trend like:
Note Country Code
MariaDB [cdi_economics]> SELECT DISTINCT country FROM gdp_wdi ORDER BY country;
+---------+
| country |
+---------+
| BI |
| CD |
| KE |
| RW |
| SO |
| SS |
| TZ |
| UG |
| US |
+---------+
9 rows in set (0.032 sec)
-- Remove the old table completely
DROP TABLE IF EXISTS gdp_wdi;
CREATE DATABASE cdi_economics;
USE cdi_economics;
CREATE TABLE gdp_wdi (
country CHAR(3),
year INT,
gdp_usd_current DOUBLE
);
LOAD DATA LOCAL INFILE '/Users/tmbmacbookair/Dropbox/GITHUB_REPOs/cdi-economics/data/gdp_wdi_EAC_USA_2000_2024.csv'
INTO TABLE gdp_wdi
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\n'
IGNORE 1 LINES
(country, year, gdp_usd_current);
-- Query Kenya's GDP trend
SELECT year, gdp_usd_current
FROM gdp_wdi
WHERE country = 'KE'
ORDER BY year;