-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathschema.sql
More file actions
59 lines (45 loc) · 1.21 KB
/
schema.sql
File metadata and controls
59 lines (45 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
drop table if exists country cascade;
CREATE TABLE country (
country_id serial primary key,
name varchar unique,
alpha_2 varchar unique,
alpha_3 varchar unique,
country_code varchar unique,
region varchar,
sub_region varchar,
region_code int,
sub_region_code int);
select * from country;
DROP TABLE IF EXISTS air_quality;
CREATE TABLE air_quality (
alpha_3 varchar NOT NULL,
year int,
Value_PM float,
Value_MR float,
Value_CO2 float,
Value_NOx float,
Value_SOx float,
FOREIGN KEY (alpha_3) REFERENCES country(alpha_3)
);
select * from air_quality;
DROP TABLE IF EXISTS coal_plants;
CREATE TABLE coal_plants (
country varchar(200),
alpha_3 varchar,
year int,
coal_mw_new int,
coal_mw_retired int,
coal_mw_change int,
FOREIGN KEY (alpha_3) REFERENCES country(alpha_3)
);
select * from coal_plants;
DROP TABLE IF EXISTS mortality_rates;
CREATE TABLE mortality_rates (
Country varchar(200),
alpha_3 varchar NOT NULL,
Year int,
"Outdoor particulate matter_deaths per 100k" float,
"Outdoor ozone pollution_deaths per 100k" float,
FOREIGN KEY (alpha_3) REFERENCES country(alpha_3)
);
select * from mortality_rates;