-
Notifications
You must be signed in to change notification settings - Fork 0
/
create_mysql_db.sql
198 lines (187 loc) · 3.9 KB
/
create_mysql_db.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
drop database if exists cow;
create database if not exists cow;
use cow;
create table if not exists country_codes (
id INT AUTO_INCREMENT NOT NULL,
StateAbb VARCHAR(3) NOT NULL,
CCode SMALLINT UNSIGNED NOT NULL,
StateNme VARCHAR(60) NOT NULL,
PRIMARY KEY (id)
);
create table if not exists states2016 (
id INT AUTO_INCREMENT NOT NULL,
stateabb VARCHAR(3) NOT NULL,
ccode SMALLINT UNSIGNED NOT NULL,
statenme VARCHAR(60),
styear SMALLINT,
stmonth TINYINT,
stday TINYINT,
endyear SMALLINT,
endmonth TINYINT,
endday TINYINT,
version INT,
PRIMARY KEY (id)
);
select * from states2016;
create table if not exists majors_2016 (
id INT AUTO_INCREMENT NOT NULL,
stateabb VARCHAR(3) NOT NULL,
ccode SMALLINT UNSIGNED NOT NULL,
styear SMALLINT,
stmonth TINYINT,
stday TINYINT,
endyear SMALLINT,
endmonth TINYINT,
endday TINYINT,
version SMALLINT,
PRIMARY KEY (id)
);
create table if not exists MIDIP_4_3 (
id INT AUTO_INCREMENT,
dispnum3 INT,
incidnum3 INT,
dispnum4 INT,
incidnum4 INT,
stabb VARCHAR(3),
ccode SMALLINT UNSIGNED NOT NULL,
stday TINYINT,
stmon TINYINT,
styear SMALLINT,
endday TINYINT,
endmon TINYINT,
endyear SMALLINT,
insidea TINYINT,
sidea TINYINT,
fatality TINYINT,
fatalpre INT,
action TINYINT,
hostlev TINYINT,
revtype1 TINYINT,
revtype2 TINYINT,
version FLOAT,
PRIMARY KEY (id)
);
create table if not exists cow_war_list (
year SMALLINT NOT NULL,
war_name VARCHAR(280) NOT NULL,
war_type_number VARCHAR(32) UNIQUE NOT NULL,
PRIMARY KEY (war_type_number)
);
create table if not exists MIDA_4_3 (
id INT AUTO_INCREMENT NOT NULL,
dispnum3 INT NOT NULL,
dispnum4 INT NOT NULL,
stday TINYINT,
stmon TINYINT,
styear SMALLINT,
endday TINYINT,
endmon TINYINT,
endyear SMALLINT,
outcome TINYINT,
settle TINYINT,
fatality TINYINT,
fatalpre INT,
maxdur INT,
mindur INT,
hiact TINYINT,
hostlev TINYINT,
recip TINYINT,
numa TINYINT,
numb TINYINT,
link1 INT,
link2 INT,
link3 INT,
ongo2010 TINYINT,
version FLOAT,
PRIMARY KEY (id)
);
create table if not exists MIDB_4_3 (
id INT AUTO_INCREMENT NOT NULL,
dispnum3 INT NOT NULL,
dispnum4 INT NOT NULL,
stabb VARCHAR(3) NOT NULL,
ccode SMALLINT UNSIGNED NOT NULL,
stday TINYINT,
stmon TINYINT,
styear SMALLINT,
endday TINYINT,
endmon TINYINT,
endyear SMALLINT,
sidea TINYINT,
revstate TINYINT,
revtype1 TINYINT,
revtype2 TINYINT,
fatality TINYINT,
fatalpre INT,
hiact SMALLINT,
hostlev TINYINT,
orig TINYINT,
version FLOAT,
PRIMARY KEY (id)
);
create table if not exists MIDI_4_3 (
id INT AUTO_INCREMENT NOT NULL,
dispnum3 INT NOT NULL,
incidnum3 INT NOT NULL,
dispnum4 INT NOT NULL,
incidnum4 INT NOT NULL,
stday TINYINT,
stmon TINYINT,
styear SMALLINT,
endday TINYINT,
endmon TINYINT,
endyear SMALLINT,
duration INT,
tbi INT,
fatality TINYINT,
fatalpre INT,
action INT,
hostlev TINYINT,
numa INT,
revtype1 INT,
revtype2 INT,
version FLOAT,
PRIMARY KEY (id)
);
create table if not exists midloci_2_0 (
id INT UNSIGNED AUTO_INCREMENT NOT NULL,
year SMALLINT,
dispnum INT,
incidnum INT,
midloc2_location VARCHAR(280),
midloc2_measuringpoint VARCHAR(280),
midloc2_xlongitude FLOAT NOT NULL,
midloc2_ylatitude FLOAT NOT NULL,
midloc2_precision INT,
onset TINYINT,
midloc2_howobtained VARCHAR(280),
midloc2_precision_comment VARCHAR(280),
midloc2_general_comment VARCHAR(280),
priogrid_cell INT,
midloc11_location VARCHAR(280),
midloc11_midlocmeasuringpoint VARCHAR(280),
midloc11_latitude FLOAT,
midloc11_longitude FLOAT,
midloc11_precision INT,
PRIMARY KEY (id)
);
create table if not exists midloca_2_0 (
id INT UNSIGNED AUTO_INCREMENT NOT NULL,
year SMALLINT,
dispnum INT,
midloc2_location VARCHAR(280),
midloc2_measuringpoint VARCHAR(280),
midloc2_xlongitude FLOAT NOT NULL,
midloc2_ylatitude FLOAT NOT NULL,
midloc2_precision INT,
midloc2_howobtained VARCHAR(280),
midloc2_precision_comment VARCHAR(280),
midloc2_general_comment VARCHAR(280),
priogrid_cell INT,
midloc11_location VARCHAR(280),
midloc11_midlocmeasuringpoint VARCHAR(280),
midloc11_latitude FLOAT,
midloc11_longitude FLOAT,
midloc11_precision INT,
PRIMARY KEY (id)
);