-
Notifications
You must be signed in to change notification settings - Fork 0
/
pre.sql
42 lines (37 loc) · 838 Bytes
/
pre.sql
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
-- Initialization
DROP TABLE election;
DROP TABLE ran_in;
DROP TABLE person;
DROP TABLE prior_poll;
CREATE TABLE election (
PRIMARY KEY (year),
year int,
winner varchar(40) references person(name),
population int,
num_voted int,
total_electoral_votes int
);
CREATE TABLE ran_in (
year int references election(year),
name varchar(40) references person(name),
party varchar(40),
popular_votes int,
electoral_votes int
);
CREATE TABLE prior_poll (
year int references election(year),
name varchar(40) references person(name),
month varchar(40),
percent int
);
CREATE TABLE person (
PRIMARY KEY (name),
name varchar(40),
ranking int
);
-- Presidents that need to be hard coded
-- John Tyler
-- Millard Fillmore
-- Andrew Johnson
-- Chester A. Arthur
-- Gerald Ford